diff options
Diffstat (limited to 'src/ortho/gcc')
-rw-r--r-- | src/ortho/gcc/ortho_gcc.adb | 11 | ||||
-rw-r--r-- | src/ortho/gcc/ortho_gcc.ads | 22 | ||||
-rw-r--r-- | src/ortho/gcc/ortho_gcc.private.ads | 2 |
3 files changed, 29 insertions, 6 deletions
diff --git a/src/ortho/gcc/ortho_gcc.adb b/src/ortho/gcc/ortho_gcc.adb index ae7b4f53b..37f782dcd 100644 --- a/src/ortho/gcc/ortho_gcc.adb +++ b/src/ortho/gcc/ortho_gcc.adb @@ -30,6 +30,17 @@ package body Ortho_Gcc is return O_Lnode (Obj); end New_Obj; + function New_Global (Decl : O_Dnode) return O_Gnode is + begin + return O_Gnode (Decl); + end New_Global; + + function New_Global_Selected_Element (Rec : O_Gnode; El : O_Fnode) + return O_Gnode is + begin + return O_Gnode (New_Selected_Element (O_Lnode (Rec), El)); + end New_Global_Selected_Element; + function New_Obj_Value (Obj : O_Dnode) return O_Enode is begin return O_Enode (Obj); diff --git a/src/ortho/gcc/ortho_gcc.ads b/src/ortho/gcc/ortho_gcc.ads index 7332ceb21..6273435dc 100644 --- a/src/ortho/gcc/ortho_gcc.ads +++ b/src/ortho/gcc/ortho_gcc.ads @@ -34,10 +34,12 @@ package Ortho_Gcc is type O_Tnode is private; type O_Snode is private; type O_Dnode is private; + type O_Gnode is private; type O_Fnode is private; O_Cnode_Null : constant O_Cnode; O_Dnode_Null : constant O_Dnode; + O_Gnode_Null : constant O_Gnode; O_Enode_Null : constant O_Enode; O_Fnode_Null : constant O_Fnode; O_Lnode_Null : constant O_Lnode; @@ -183,17 +185,17 @@ package Ortho_Gcc is -- Get the address of a subprogram. function New_Subprogram_Address (Subprg : O_Dnode; Atype : O_Tnode) - return O_Cnode; + return O_Cnode; -- Get the address of LVALUE. -- ATYPE must be a type access whose designated type is the type of LVALUE. -- FIXME: what about arrays. - function New_Global_Address (Decl : O_Dnode; Atype : O_Tnode) + function New_Global_Address (Lvalue : O_Gnode; Atype : O_Tnode) return O_Cnode; -- Same as New_Address but without any restriction. - function New_Global_Unchecked_Address (Decl : O_Dnode; Atype : O_Tnode) - return O_Cnode; + function New_Global_Unchecked_Address (Lvalue : O_Gnode; Atype : O_Tnode) + return O_Cnode; ------------------- -- Expressions -- @@ -292,12 +294,15 @@ package Ortho_Gcc is -- base type of ARR. -- INDEX must be of the type of the array index. function New_Slice (Arr : O_Lnode; Res_Type : O_Tnode; Index : O_Enode) - return O_Lnode; + return O_Lnode; -- Get an element of a record or a union. -- Type of REC must be a record or a union type. function New_Selected_Element (Rec : O_Lnode; El : O_Fnode) - return O_Lnode; + return O_Lnode; + + function New_Global_Selected_Element (Rec : O_Gnode; El : O_Fnode) + return O_Gnode; -- Reference an access. -- Type of ACC must be an access type. @@ -324,6 +329,9 @@ package Ortho_Gcc is -- Get an lvalue from a declaration. function New_Obj (Obj : O_Dnode) return O_Lnode; + -- Get a global lvalue from a declaration. + function New_Global (Decl : O_Dnode) return O_Gnode; + -- Return a pointer of type RTPE to SIZE bytes allocated on the stack. function New_Alloca (Rtype : O_Tnode; Size : O_Enode) return O_Enode; @@ -474,6 +482,7 @@ private type O_Cnode is new Tree; type O_Enode is new Tree; type O_Lnode is new Tree; + type O_Gnode is new Tree; type O_Tnode is new Tree; type O_Fnode is new Tree; type O_Dnode is new Tree; @@ -486,6 +495,7 @@ private O_Cnode_Null : constant O_Cnode := O_Cnode (NULL_TREE); O_Enode_Null : constant O_Enode := O_Enode (NULL_TREE); O_Lnode_Null : constant O_Lnode := O_Lnode (NULL_TREE); + O_Gnode_Null : constant O_Gnode := O_Gnode (NULL_TREE); O_Tnode_Null : constant O_Tnode := O_Tnode (NULL_TREE); O_Fnode_Null : constant O_Fnode := O_Fnode (NULL_TREE); O_Snode_Null : constant O_Snode := (NULL_TREE, NULL_TREE); diff --git a/src/ortho/gcc/ortho_gcc.private.ads b/src/ortho/gcc/ortho_gcc.private.ads index fcbc59129..3bae8526e 100644 --- a/src/ortho/gcc/ortho_gcc.private.ads +++ b/src/ortho/gcc/ortho_gcc.private.ads @@ -38,6 +38,7 @@ private type O_Cnode is new Tree; type O_Enode is new Tree; type O_Lnode is new Tree; + type O_Gnode is new Tree; type O_Tnode is new Tree; type O_Fnode is new Tree; type O_Dnode is new Tree; @@ -50,6 +51,7 @@ private O_Cnode_Null : constant O_Cnode := O_Cnode (NULL_TREE); O_Enode_Null : constant O_Enode := O_Enode (NULL_TREE); O_Lnode_Null : constant O_Lnode := O_Lnode (NULL_TREE); + O_Gnode_Null : constant O_Gnode := O_Gnode (NULL_TREE); O_Tnode_Null : constant O_Tnode := O_Tnode (NULL_TREE); O_Fnode_Null : constant O_Fnode := O_Fnode (NULL_TREE); O_Snode_Null : constant O_Snode := (NULL_TREE, NULL_TREE); |