diff options
author | Tristan Gingold <tgingold@free.fr> | 2014-01-25 21:16:44 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2014-01-25 21:16:44 +0100 |
commit | 2cc6d66e785130bb757bcb73e96cfffdc2c2f0b7 (patch) | |
tree | 0e1c76137b2da38b1b065d519f005a00a90c4ad9 /ortho/gcc | |
parent | 2bfd9df129c8517776455c6c402a63b79b841257 (diff) | |
download | ghdl-2cc6d66e785130bb757bcb73e96cfffdc2c2f0b7.tar.gz ghdl-2cc6d66e785130bb757bcb73e96cfffdc2c2f0b7.tar.bz2 ghdl-2cc6d66e785130bb757bcb73e96cfffdc2c2f0b7.zip |
new_offsetof: add argument for record type (llvm preliminary work).
Diffstat (limited to 'ortho/gcc')
-rw-r--r-- | ortho/gcc/ortho-lang.c | 4 | ||||
-rw-r--r-- | ortho/gcc/ortho_gcc.ads | 7 |
2 files changed, 7 insertions, 4 deletions
diff --git a/ortho/gcc/ortho-lang.c b/ortho/gcc/ortho-lang.c index 5404afbc9..fe02dbcf0 100644 --- a/ortho/gcc/ortho-lang.c +++ b/ortho/gcc/ortho-lang.c @@ -1442,13 +1442,15 @@ new_access_element (tree acc) } tree -new_offsetof (tree field, tree rtype) +new_offsetof (tree rec_type, tree field, tree rtype) { tree off; tree bit_off; HOST_WIDE_INT pos; tree res; + gcc_assert (DECL_CONTEXT (field) == rec_type); + off = DECL_FIELD_OFFSET (field); /* The offset must be a constant. */ diff --git a/ortho/gcc/ortho_gcc.ads b/ortho/gcc/ortho_gcc.ads index 31005ae6c..d01caeed8 100644 --- a/ortho/gcc/ortho_gcc.ads +++ b/ortho/gcc/ortho_gcc.ads @@ -237,9 +237,10 @@ package Ortho_Gcc is -- unsgined type RTYPE. function New_Alignof (Atype : O_Tnode; Rtype : O_Tnode) return O_Cnode; - -- Returns the offset of FIELD in its record. The result is a literal - -- of unsigned type RTYPE. - function New_Offsetof (Field : O_Fnode; Rtype : O_Tnode) return O_Cnode; + -- Returns the offset of FIELD in its record REC_TYPE. The result is a + -- literal of unsigned type or access type RTYPE. + function New_Offsetof (Rec_Type : O_Tnode; Field : O_Fnode; Rtype : O_Tnode) + return O_Cnode; -- Get an element of an array. -- INDEX must be of the type of the array index. |