aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_dim.ads
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2011-12-15 15:33:46 +0100
committerArnaud Charlet <charlet@gcc.gnu.org>2011-12-15 15:33:46 +0100
commitdec6faf1db26d2c0a47eff4ea31d92cfdf0eec15 (patch)
tree20975a66444ac1e00f9193125dafa7c1e23e8fe7 /gcc/ada/sem_dim.ads
parentca814625c9cd6487a70ef1449941cfac575858e2 (diff)
downloadgcc-dec6faf1db26d2c0a47eff4ea31d92cfdf0eec15.zip
gcc-dec6faf1db26d2c0a47eff4ea31d92cfdf0eec15.tar.gz
gcc-dec6faf1db26d2c0a47eff4ea31d92cfdf0eec15.tar.bz2
[multiple changes]
2011-12-15 Vincent Pucci <pucci@adacore.com> * aspects.adb, aspects.ads Aspect_Dimension and Aspect_Dimension_System added * exp_ch6.adb (Expand_Call): Expand_Put_Call_With_Dimension_String case added * gcc-interface/Make-lang.in: s-llflex, sem_dim added. * impunit.adb :s-diflio and s-diinio defined as GNAT Defined Additions to System. * Makefile.rtl: s-diflio, s-diinio and s-llflex added * par-prag.adb, sem_prag.adb: Pragma_Dimension removed * rtsfind.ads: Expon_LLF added * sem_aggr.adb (Resolve_Aggregate): handles aggregate for Aspect_Dimension case * sem_attr.adb (Resolve_Attribute): analyze dimension for attribute * sem_ch10.adb (Analyze_With_Clause): Avoid the warning messages due to the use of a GNAT library for Dimension packages * sem_ch13.adb (Analyze_Aspect_Specifications): Aspect_Dimension and Aspect_Dimension_System cases added (Check_Aspect_At_Freeze_Point): Aspect_Dimension and Aspect_Dimension_System cases added * sem_ch2.adb (Analyze_Identifier): analyze dimension for identifier * sem_ch3.adb (Analyze_Component_Declaration): analyze dimension for component declaration (Analyze_Object_Declaration): analyze dimension for object declaration (Analyze_Subtype_Declaration): analyze dimension for subtype declaration * sem_ch4.adb (Operator_Check): checks exponent is a rational for dimensioned operand for a N_Op_Expon * sem_ch5.adb (Analyze_Assignment): analyze dimension for assignment (Analyze_Statements): removal of dimensions in all statements * sem_ch6.adb (Analyze_Return_Statement): analyze dimension for return statement * sem_ch8.adb (Analyze_Object_Renaming): analyze dimension for object renaming * sem_dim.adb, sem_dim.ads (Analyze_Aspect_Dimension): analyze the expression for aspect dimension and store the values in a Htable. (Analyze_Aspect_Dimension_System): analyze the expression for aspect dimension system and store the new system in a Table. (Analyze_Dimension): propagates dimension (Expand_Put_Call_With_Dimension_String): add the dimension string as a suffix of the numeric value in the output (Has_Dimension): return True if the node has a dimension (Remove_Dimension_In_Declaration): removal of dimension in the expression of the declaration. (Remove_Dimension_In_Statement): removal of dimension in statement * sem_res.adb (Resolve): analyze dimension if the node has already been analyzed. (Resolve_Arithmetic_Op): analyze dimension for arithmetic op. (Resolve_Call): analyze dimension for function call. (Resolve_Comparison_Op): analyze dimension for comparison op. (Resolve_Equality_Op): analyze dimension for equality op. (Resolve_Indexed_Component): analyze dimension for indexed component. (Resolve_Op_Expon): analyze dimension for op expon. (Resolve_Selected_Component): analyze dimension for selected component. (Resolve_Slice): analyze dimension for slice. (Resolve_Unary_Op): analyze dimension for unary op (Resolve_Type_Conversion): analyze dimension for type conversion (Resolve_Unchecked_Type_Conversion): analyze dimension for unchecked type conversion * snames.ads-tmpl Name_Dimension, Name_Dimension_System, Name_Dim_Float_IO, Name_Dim_Integer_IO, Name_Generic_Elementary_Functions, Name_Sqrt added. Pragma_Dimension removed * s-diflio.adb, s-diflio.ads New GNAT library generic package for dimensioned float type IO * s-diinio.adb, s-diinio.ads New GNAT library generic package for dimensioned integer type IO * s-llflex.ads (Expon_LLF): exponentiation routine for long long floats operand and exponent 2011-12-15 Robert Dewar <dewar@adacore.com> * sem_aggr.adb: Minor comment addition. 2011-12-15 Bob Duff <duff@adacore.com> * s-tasren.adb (Task_Count): Do not call Yield; E'Count is not a task dispatching point. * s-taprop-mingw.adb (Yield): Do not yield if Do_Yield is False. From-SVN: r182368
Diffstat (limited to 'gcc/ada/sem_dim.ads')
-rw-r--r--gcc/ada/sem_dim.ads150
1 files changed, 150 insertions, 0 deletions
diff --git a/gcc/ada/sem_dim.ads b/gcc/ada/sem_dim.ads
new file mode 100644
index 0000000..8089f43
--- /dev/null
+++ b/gcc/ada/sem_dim.ads
@@ -0,0 +1,150 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- S E M _ D I M --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2011, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
+-- for more details. You should have received a copy of the GNU General --
+-- Public License distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This new package of the GNAT compiler has been created in order to enable
+-- any user of the GNAT compiler to deal with physical issues.
+
+-- Indeed, the user is now able to create his own dimension system and to
+-- assign a dimension, defined from the MKS system (package System.Dim_Mks)
+-- or his own dimension systems, with any item and to run operations with
+-- dimensionned entities.
+-- In that case, a dimensionnality checking will be performed at compile time.
+-- If no dimension has been assigned, the compiler assumes that the item is
+-- dimensionless.
+
+-----------------------------
+-- Aspect_Dimension_System --
+-----------------------------
+
+-- In order to enable the user to create his own dimension system, a new
+-- aspect: Aspect_Dimension_System has been created.
+-- Note that this aspect applies for type declaration of type derived from any
+-- numeric type.
+
+-- It defines the names of each dimension.
+
+----------------------
+-- Aspect_Dimension --
+----------------------
+
+-- This new aspect applies for subtype and object declarations in order to
+-- define new dimensions.
+-- Using this aspect, the user is able to create new subtype/object with any
+-- dimension needed.
+-- Note that the base type of the subtype/object must be the type that defines
+-- the corresponding dimension system.
+
+-- The expression of this aspect is an aggregate of rational values for each
+-- dimension in the corresponding dimension system.
+
+-------------------------------------------
+-- Dimensionality checking & propagation --
+-------------------------------------------
+
+-- For each node (when needed), a dimension analysis (Analyze_Dimension) is
+-- performed as part of the Resolution routine or the Analysis routine if no
+-- Resolution.
+
+-- The dimension analysis is divided into two phases:
+
+-- Phase 1: dimension checking
+
+-- Phase 2: propagation of dimensions
+
+-- Depending on the node kind, either none, one phase or two phases are
+-- executed.
+-- Phase 2 is called only when the node allows a dimension (see body of
+-- Sem_Dim to get the list of nodes that permit dimensions).
+
+------------------
+-- Dimension_IO --
+------------------
+
+-- This section contains the routine used for IO purposes.
+
+with Types; use Types;
+
+package Sem_Dim is
+
+ -----------------------------
+ -- Aspect_Dimension_System --
+ -----------------------------
+
+ procedure Analyze_Aspect_Dimension_System
+ (N : Node_Id;
+ Id : Node_Id;
+ Expr : Node_Id);
+ -- Analyzes the aggregate of Aspect_Dimension_System
+
+ ----------------------
+ -- Aspect_Dimension --
+ ----------------------
+
+ procedure Analyze_Aspect_Dimension
+ (N : Node_Id;
+ Id : Node_Id;
+ Expr : Node_Id);
+ -- Analyzes the aggregate of Aspect_Dimension and attaches the
+ -- corresponding dimension to N.
+
+ -------------------------------------------
+ -- Dimensionality checking & propagation --
+ -------------------------------------------
+
+ procedure Analyze_Dimension (N : Node_Id);
+ -- Performs a dimension analysis and propagates dimension between nodes
+ -- when needed.
+
+ procedure Eval_Op_Expon_For_Dimensioned_Type
+ (N : Node_Id;
+ B_Typ : Entity_Id);
+ -- Eval the Expon operator for dimensioned type with rational exponent
+
+ function Is_Dimensioned_Type (E : Entity_Id) return Boolean;
+ -- Return True if the type is a dimensioned type (i.e: a type which has an
+ -- aspect Dimension_System)
+
+ procedure Remove_Dimension_In_Call (N : Node_Id);
+ -- At the end of the Expand_Call routine, remove the dimensions of every
+ -- parameters in the call N.
+
+ procedure Remove_Dimension_In_Declaration (D : Node_Id);
+ -- At the end of Analyze_Declarations routine (see Sem_Ch3), removes the
+ -- dimension of the expression for each declaration.
+
+ procedure Remove_Dimension_In_Statement (S : Node_Id);
+ -- At the end of the Analyze_Statements routine (see Sem_Ch5), removes the
+ -- dimension for every statements.
+
+ ------------------
+ -- Dimension_IO --
+ ------------------
+
+ procedure Expand_Put_Call_With_Dimension_String (N : Node_Id);
+ -- Expansion of Put call (from package System.Dim_Float_IO and
+ -- System.Dim_Integer_IO) for a dimensioned object in order to add the
+ -- dimension symbols as a suffix of the numeric value.
+
+end Sem_Dim;