File : exp_fixd.ads


   1 ------------------------------------------------------------------------------
   2 --                                                                          --
   3 --                         GNAT COMPILER COMPONENTS                         --
   4 --                                                                          --
   5 --                             E X P _ F I X D                              --
   6 --                                                                          --
   7 --                                 S p e c                                  --
   8 --                                                                          --
   9 --          Copyright (C) 1992-2008, Free Software Foundation, Inc.         --
  10 --                                                                          --
  11 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
  12 -- terms of the  GNU General Public License as published  by the Free Soft- --
  13 -- ware  Foundation;  either version 3,  or (at your option) any later ver- --
  14 -- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
  15 -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
  16 -- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
  17 -- for  more details.  You should have  received  a copy of the GNU General --
  18 -- Public License  distributed with GNAT; see file COPYING3.  If not, go to --
  19 -- http://www.gnu.org/licenses for a complete copy of the license.          --
  20 --                                                                          --
  21 -- GNAT was originally developed  by the GNAT team at  New York University. --
  22 -- Extensive contributions were provided by Ada Core Technologies Inc.      --
  23 --                                                                          --
  24 ------------------------------------------------------------------------------
  25 
  26 --  Expand routines for fixed-point convert, divide and multiply operations
  27 
  28 with Types; use Types;
  29 
  30 package Exp_Fixd is
  31 
  32    --  General note on universal fixed. In the routines below, a fixed-point
  33    --  type is always a specific fixed-point type or universal real, never
  34    --  universal fixed. Universal fixed only appears as the result type of a
  35    --  division or multiplication and in all such cases, the parent node, which
  36    --  must be either a conversion node or a 'Round attribute reference node,
  37    --  has the specific type information. In both cases, the parent node is
  38    --  removed from the tree, and the appropriate routine in this package is
  39    --  called with a multiply or divide node with all types (and also possibly
  40    --  the Rounded_Result flag) set.
  41 
  42    ----------------------------
  43    -- Fixed-Point Conversion --
  44    ----------------------------
  45 
  46    procedure Expand_Convert_Fixed_To_Fixed (N : Node_Id);
  47    --  This routine expands the conversion of one fixed-point type to another,
  48    --  N is the N_Op_Conversion node with the result and expression types (and
  49    --  possibly the Rounded_Result flag) set.
  50 
  51    procedure Expand_Convert_Fixed_To_Float (N : Node_Id);
  52    --  This routine expands the conversion from a fixed-point type to a
  53    --  floating-point type. N is an N_Type_Conversion node with the result
  54    --  and expression types set.
  55 
  56    procedure Expand_Convert_Fixed_To_Integer (N : Node_Id);
  57    --  This routine expands the conversion from a fixed-point type to an
  58    --  integer type. N is an N_Type_Conversion node with the result and
  59    --  operand types set.
  60 
  61    procedure Expand_Convert_Float_To_Fixed (N : Node_Id);
  62    --  This routine expands the conversion from a floating-point type to
  63    --  a fixed-point type. N is an N_Type_Conversion node with the result
  64    --  and operand types (and possibly the Rounded_Result flag) set.
  65 
  66    procedure Expand_Convert_Integer_To_Fixed (N : Node_Id);
  67    --  This routine expands the conversion from an integer type to a
  68    --  fixed-point type. N is an N_Type_Conversion node with the result
  69    --  and operand types (and possibly the Rounded_Result flag) set.
  70 
  71    --------------------------
  72    -- Fixed-Point Division --
  73    --------------------------
  74 
  75    procedure Expand_Decimal_Divide_Call (N : Node_Id);
  76    --  This routine expands a call to the procedure Decimal.Divide. The
  77    --  argument N is the N_Function_Call node.
  78 
  79    procedure Expand_Divide_Fixed_By_Fixed_Giving_Fixed (N : Node_Id);
  80    --  This routine expands the division between fixed-point types, with
  81    --  a fixed-point type result. N is an N_Op_Divide node with operand
  82    --  and result types (and possibly the Rounded_Result flag) set. Either
  83    --  (but not both) of the operands may be universal real.
  84 
  85    procedure Expand_Divide_Fixed_By_Fixed_Giving_Float (N : Node_Id);
  86    --  This routine expands the division between two fixed-point types with
  87    --  a floating-point result. N is an N_Op_Divide node with the result
  88    --  and operand types set. Either (but not both) of the operands may be
  89    --  universal real.
  90 
  91    procedure Expand_Divide_Fixed_By_Fixed_Giving_Integer (N : Node_Id);
  92    --  This routine expands the division between two fixed-point types with
  93    --  an integer type result. N is an N_Op_Divide node with the result and
  94    --  operand types set. Either (but not both) of the operands may be
  95    --  universal real.
  96 
  97    procedure Expand_Divide_Fixed_By_Integer_Giving_Fixed (N : Node_Id);
  98    --  This routine expands the division between a fixed-point type and
  99    --  standard integer type. The result type is the same fixed-point type
 100    --  as the operand type. N is an N_Op_Divide node with the result and
 101    --  left operand types being the fixed-point type, and the right operand
 102    --  type being standard integer (and possibly Rounded_Result set).
 103 
 104    --------------------------------
 105    -- Fixed-Point Multiplication --
 106    --------------------------------
 107 
 108    procedure Expand_Multiply_Fixed_By_Fixed_Giving_Fixed (N : Node_Id);
 109    --  This routine expands the multiplication between fixed-point types
 110    --  with a fixed-point type result. N is an N_Op_Multiply node with the
 111    --  result and operand types set. Either (but not both) of the operands
 112    --  may be universal real.
 113 
 114    procedure Expand_Multiply_Fixed_By_Fixed_Giving_Float (N : Node_Id);
 115    --  This routine expands the multiplication between two fixed-point types
 116    --  with a floating-point result. N is an N_Op_Multiply node with the
 117    --  result and operand types set. Either (but not both) of the operands
 118    --  may be universal real.
 119 
 120    procedure Expand_Multiply_Fixed_By_Fixed_Giving_Integer (N : Node_Id);
 121    --  This routine expands the multiplication between two fixed-point types
 122    --  with an integer result. N is an N_Op_Multiply node with the result
 123    --  and operand types set. Either (but not both) of the operands may be
 124    --  be universal real.
 125 
 126    procedure Expand_Multiply_Fixed_By_Integer_Giving_Fixed (N : Node_Id);
 127    --  This routine expands the multiplication between a fixed-point type and
 128    --  a standard integer type. The result type is the same fixed-point type
 129    --  as the fixed operand type. N is an N_Op_Multiply node whose result type
 130    --  and left operand types are the fixed-point type, and whose right operand
 131    --  type is always standard integer.
 132 
 133    procedure Expand_Multiply_Integer_By_Fixed_Giving_Fixed (N : Node_Id);
 134    --  This routine expands the multiplication between standard integer and a
 135    --  fixed-point type. The result type is the same fixed-point type as the
 136    --  fixed operand type. N is an N_Op_Multiply node whose result type
 137    --  and right operand types are the fixed-point type, and whose left operand
 138    --  type is always standard integer.
 139 
 140 end Exp_Fixd;