switch-c.adb: Minor reformatting.
authorRobert Dewar <dewar@adacore.com>
Tue, 10 Sep 2013 15:16:41 +0000 (15:16 +0000)
committerArnaud Charlet <charlet@gcc.gnu.org>
Tue, 10 Sep 2013 15:16:41 +0000 (17:16 +0200)
2013-09-10  Robert Dewar  <dewar@adacore.com>

* switch-c.adb: Minor reformatting.
* atree.ads (Original_Nodes): Add documentation on ASIS usage.
* sinfo.ads: Add section on ASIS mode (documentation only).

From-SVN: r202464

gcc/ada/ChangeLog
gcc/ada/atree.ads
gcc/ada/sinfo.ads
gcc/ada/switch-c.adb

index 10c5594..9440fe6 100644 (file)
@@ -1,5 +1,11 @@
 2013-09-10  Robert Dewar  <dewar@adacore.com>
 
+       * switch-c.adb: Minor reformatting.
+       * atree.ads (Original_Nodes): Add documentation on ASIS usage.
+       * sinfo.ads: Add section on ASIS mode (documentation only).
+
+2013-09-10  Robert Dewar  <dewar@adacore.com>
+
        * sem_prag.adb (Analyze_Pragma, case Warnings): Don't allow
        REASON parameter in compiler units (bootstrap issues).
 
index d1056b0..123beb3 100644 (file)
@@ -939,12 +939,15 @@ package Atree is
    function Original_Node (Node : Node_Id) return Node_Id;
    pragma Inline (Original_Node);
    --  If Node has not been rewritten, then returns its input argument
-   --  unchanged, else returns the Node for the original subtree.
+   --  unchanged, else returns the Node for the original subtree. Note that
+   --  this is used extensively by ASIS on the trees constructed in ASIS mode
+   --  to reconstruct the original semantic tree. See section in sinfo.ads
+   --  for requirements on original nodes returned by this function.
    --
    --  Note: Parents are not preserved in original tree nodes that are
    --  retrieved in this way (i.e. their children may have children whose
-   --  pointers which reference some other node).
-
+   --  pointers which reference some other node). This needs more details???
+   --
    --  Note: there is no direct mechanism for deleting an original node (in
    --  a manner that can be reversed later). One possible approach is to use
    --  Rewrite to substitute a null statement for the node to be deleted.
index 37a6e14..112f8fc 100644 (file)
@@ -455,6 +455,59 @@ package Sinfo is
    --  code is being generated, since they involved expander actions that
    --  destroy the tree.
 
+   ---------------
+   -- ASIS Mode --
+   ---------------
+
+   --  When a file is compiled in ASIS mode (-gnatct), expansion is skipped,
+   --  and the analysis must generate a tree in a form that meets all ASIS
+   --  requirements.
+
+   --  ASIS must be able to recover the original tree that corresponds to the
+   --  source. It relies heavily on Original_Node for this purpose, which as
+   --  described in Atree, records the history when a node is rewritten. ASIS
+   --  uses Original_Node to recover the original node before the Rewrite.
+
+   --  At least in ASIS mode (not really important in non-ASIS mode), when
+   --  N1 is rewritten as N2:
+
+   --    The subtree rooted by the original node N1 should be fully decorated,
+   --    i.e. all semantic fields noted in sinfo.ads should be set properly
+   --    and any referenced entities should be complete (with exceptions for
+   --    representation information, noted below).
+
+   --    For all the direct descendants of N1 (original node) their Parent
+   --    links should point not to N1, but to N2 (rewriting node).
+
+   --    The Parent links of rewritten nodes (N1 in this example) are set in
+   --    some cases (to point to the rewritten parent), but in other cases
+   --    they are set to Empty. This needs sorting out ??? It would be much
+   --    cleaner if they could always be set in the original node ???
+
+   --  Representation Information
+
+   --    For the purposes of the data description annex, the representation
+   --    information for source declared entities must be complete in the
+   --    ASIS tree.
+
+   --    This requires that the front end call the back end (gigi/gcc) in
+   --    a special "back annotate only" mode to obtain information on layout
+   --    from the back end.
+
+   --    For the purposes of this special "back annotate only" mode, the
+   --    requirements that would normally need to be met to generate code
+   --    are relaxed as follows:
+
+   --      Anonymous types need not have full representation information (e.g.
+   --      sizes need not be set for types where the front end would normally
+   --      set the sizes), since anonymous types can be ignored in this mode.
+
+   --      In this mode, gigi will see at least fragments of a fully annotated
+   --      unexpanded tree. This means that it will encounter nodes it does
+   --      not normally handle (such as stubs, task bodies etc). It should
+   --      simply ignore these nodes, since they are not relevant to the task
+   --      of back annotating representation information.
+
    ------------------------
    -- Common Flag Fields --
    ------------------------
index 34d5b08..2cca5d1 100644 (file)
@@ -31,9 +31,9 @@ with Debug;    use Debug;
 with Lib;      use Lib;
 with Osint;    use Osint;
 with Opt;      use Opt;
-with Validsw;  use Validsw;
 with Stylesw;  use Stylesw;
 with Ttypes;   use Ttypes;
+with Validsw;  use Validsw;
 with Warnsw;   use Warnsw;
 
 with Ada.Unchecked_Deallocation;