2012-03-07 Eric Botcazou <ebotcazou@adacore.com>
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 7 Mar 2012 14:15:16 +0000 (14:15 +0000)
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 7 Mar 2012 14:15:16 +0000 (14:15 +0000)
* gnat_ugn.texi (Inline Assembler): Fix swapping of Input and
Output operands throughout.

2012-03-07  Hristian Kirtchev  <kirtchev@adacore.com>

* sem_ch12.adb (Earlier): When two nodes come from the same
generic instantiation, compare their locations. Otherwise always
use the top level locations of the nodes.

2012-03-07  Thomas Quinot  <quinot@adacore.com>

* einfo.ads, sem_prag.adb: Minor reformatting.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@185044 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ada/ChangeLog
gcc/ada/einfo.ads
gcc/ada/gnat_ugn.texi
gcc/ada/sem_ch12.adb
gcc/ada/sem_prag.adb

index 2bbdb35..228c442 100644 (file)
@@ -1,3 +1,18 @@
+2012-03-07  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * gnat_ugn.texi (Inline Assembler): Fix swapping of Input and
+       Output operands throughout.
+
+2012-03-07  Hristian Kirtchev  <kirtchev@adacore.com>
+
+       * sem_ch12.adb (Earlier): When two nodes come from the same
+       generic instantiation, compare their locations. Otherwise always
+       use the top level locations of the nodes.
+
+2012-03-07  Thomas Quinot  <quinot@adacore.com>
+
+       * einfo.ads, sem_prag.adb: Minor reformatting.
+
 2012-03-05  Jason Merrill  <jason@redhat.com>
 
        * gcc-interface/Make-lang.in (doc/gnat_ugn.texi): Build xgnatugn
index e0d7654..648bf83 100644 (file)
@@ -2819,7 +2819,7 @@ package Einfo is
 --       interface types. At run-time thunks displace the pointer to the object
 --       (pointer named "this" in the C++ terminology) from a secondary
 --       dispatch table to the primary dispatch table associated with a given
---       tagged type. Set by Expand_Interface Thunk and used by Expand_Call to
+--       tagged type. Set by Expand_Interface_Thunk and used by Expand_Call to
 --       handle extra actuals associated with accessibility level.
 
 --    Is_Trivial_Subprogram (Flag235)
index 4d0c01c..e93320c 100644 (file)
@@ -26107,8 +26107,8 @@ procedure Increment is
       Result : Unsigned_32;
    begin
       Asm ("incl %0",
-           Inputs  => Unsigned_32'Asm_Input ("a", Value),
-           Outputs => Unsigned_32'Asm_Output ("=a", Result));
+           Outputs => Unsigned_32'Asm_Output ("=a", Result),
+           Inputs  => Unsigned_32'Asm_Input ("a", Value));
       return Result;
    end Incr;
 
@@ -26134,10 +26134,8 @@ The @code{"="} constraint, indicating an output value, is not present.
 You can have multiple input variables, in the same way that you can have more
 than one output variable.
 
-The parameter count (%0, %1) etc, now starts at the first input
-statement, and continues with the output statements.
-When both parameters use the same variable, the
-compiler will treat them as the same %n operand, which is the case here.
+The parameter count (%0, %1) etc, still starts at the first output statement,
+and continues with the input statements.
 
 Just as the @code{Outputs} parameter causes the register to be stored into the
 target variable after execution of the assembler statements, so does the
@@ -26191,8 +26189,8 @@ procedure Increment_2 is
       Result : Unsigned_32;
    begin
       Asm ("incl %0",
-           Inputs  => Unsigned_32'Asm_Input ("a", Value),
-           Outputs => Unsigned_32'Asm_Output ("=a", Result));
+           Outputs => Unsigned_32'Asm_Output ("=a", Result),
+           Inputs  => Unsigned_32'Asm_Input ("a", Value));
       return Result;
    end Incr;
    pragma Inline (Increment);
@@ -26274,8 +26272,8 @@ assembly code; for example:
 @group
 Asm ("movl %0, %%ebx" & LF & HT &
      "movl %%ebx, %1",
-     Inputs  => Unsigned_32'Asm_Input  ("g", Var_In),
-     Outputs => Unsigned_32'Asm_Output ("=g", Var_Out));
+     Outputs => Unsigned_32'Asm_Output ("=g", Var_Out),
+     Inputs  => Unsigned_32'Asm_Input  ("g", Var_In));
 @end group
 @end smallexample
 @noindent
@@ -26289,8 +26287,8 @@ to identify the registers that will be used by your assembly code:
 @group
 Asm ("movl %0, %%ebx" & LF & HT &
      "movl %%ebx, %1",
-     Inputs  => Unsigned_32'Asm_Input  ("g", Var_In),
      Outputs => Unsigned_32'Asm_Output ("=g", Var_Out),
+     Inputs  => Unsigned_32'Asm_Input  ("g", Var_In),
      Clobber => "ebx");
 @end group
 @end smallexample
@@ -26324,8 +26322,8 @@ the @code{Volatile} parameter to @code{True}; for example:
 @group
 Asm ("movl %0, %%ebx" & LF & HT &
      "movl %%ebx, %1",
-     Inputs   => Unsigned_32'Asm_Input  ("g", Var_In),
      Outputs  => Unsigned_32'Asm_Output ("=g", Var_Out),
+     Inputs   => Unsigned_32'Asm_Input  ("g", Var_In),
      Clobber  => "ebx",
      Volatile => True);
 @end group
index c463e57..d637827 100644 (file)
@@ -7159,12 +7159,22 @@ package body Sem_Ch12 is
       end if;
 
       --  At this point either both nodes came from source or we approximated
-      --  their source locations through neighbouring source statements. There
-      --  is no need to look at the top level locations of P1 and P2 because
-      --  both nodes are in the same list and whether the enclosing context is
-      --  instantiated is irrelevant.
+      --  their source locations through neighbouring source statements.
 
-      return Sloc (P1) < Sloc (P2);
+      --  When two nodes come from the same instance, they have identical top
+      --  level locations. To determine proper relation within the tree, check
+      --  their locations within the template.
+
+      if Top_Level_Location (Sloc (P1)) = Top_Level_Location (Sloc (P2)) then
+         return Sloc (P1) < Sloc (P2);
+
+      --  The two nodes either come from unrelated instances or do not come
+      --  from instantiated code at all.
+
+      else
+         return Top_Level_Location (Sloc (P1))
+              < Top_Level_Location (Sloc (P2));
+      end if;
    end Earlier;
 
    ----------------------
index 72d47ab..39d406e 100644 (file)
@@ -11965,8 +11965,8 @@ package body Sem_Prag is
 
                if not Is_Entity_Name (Get_Pragma_Arg (Arg1))
                  or else not
-                  Ekind_In (Entity (Get_Pragma_Arg (Arg1)), E_Variable,
-                                                            E_Constant)
+                   Ekind_In (Entity (Get_Pragma_Arg (Arg1)), E_Variable,
+                                                             E_Constant)
                then
                   Error_Pragma_Arg ("pragma% only applies to objects", Arg1);
                end if;