ROSE 0.11.145.354
abiStuff.h
1#ifndef ROSE_ABISTUFF_H
2#define ROSE_ABISTUFF_H
3
4
5#include <vector>
6#include <string>
7#include <iosfwd>
8
10
14 {
15 // optional values like x86, x86-64, ia64, sparcv9, sparcv8 etc.
16 std::string str_abi;
17 //Primitive types: redundant if ABI is specified.
18 size_t sz_bool;
19 size_t sz_alignof_bool;
20 size_t sz_char;
21 size_t sz_alignof_char;
22 size_t sz_int;
23 size_t sz_alignof_int;
24 size_t sz_short;
25 size_t sz_alignof_short;
26 size_t sz_long;
27 size_t sz_alignof_long;
28 size_t sz_longlong;
29 size_t sz_alignof_longlong;
30 size_t sz_float;
31 size_t sz_alignof_float;
32 size_t sz_float16;
33 size_t sz_alignof_float16;
34 size_t sz_double;
35 size_t sz_alignof_double;
36 size_t sz_longdouble;
37 size_t sz_alignof_longdouble;
38 size_t sz_pointer; // memory handle
39 size_t sz_alignof_pointer;
40 size_t sz_reference;
41 size_t sz_alignof_reference;
42
43 //Extended types beyond ABI's scope
44 size_t sz_void_ptr;
45 size_t sz_alignof_void_ptr;
46 size_t sz_ptrdiff_t;
47 size_t sz_alignof_ptrdiff_t;
48 size_t sz_size_t;
49 size_t sz_alignof_size_t;
50 size_t sz_wchar;
51 size_t sz_alignof_wchar;
52
53 //UPC specified sizes
54 size_t sz_shared_ptr;
55 size_t sz_alignof_shared_ptr;
56 size_t sz_pshared_ptr;
57 size_t sz_alignof_pshared_ptr;
58 size_t sz_mem_handle;
59 size_t sz_alignof_mem_handle;
60 size_t sz_reg_handle;
61 size_t sz_alignof_reg_handle;
62
63 size_t sz_alignof_dbl_1st;
64 size_t sz_alignof_int64_1st;
65 size_t sz_alignof_sharedptr_1st ;
66 size_t sz_alignof_psharedptr_1st ;
67 size_t sz_alignof_dbl_innerstruct;
68 size_t sz_alignof_int64_innerstruct;
69 size_t sz_alignof_sharedptr_innerstruct ;
70 size_t sz_alignof_psharedptr_innerstruct;
71 size_t sz_maxblocksz;
72 };
73
94
97 size_t size;
99 size_t alignment;
101 std::vector<StructLayoutEntry> fields;
102
103 StructLayoutInfo(): size(0), alignment(0), fields() {}
104};
105
106std::ostream& operator<<(std::ostream& o, const StructLayoutEntry& e);
107std::ostream& operator<<(std::ostream& o, const StructLayoutInfo& i);
108
110// modifiers
112 public:
116 StructCustomizedSizes* custom_sizes;
117
119#ifdef _MSC_VER
120 : next(NULL), beginning(NULL), custom_sizes(sizes)
121 {
122 // DQ (11/27/2009): MSVC reports a warning when "this" is used in the preinitialization list.
123 beginning = this;
124 this->setNext(nx);
125 }
126#else
127 : next(NULL), beginning(this), custom_sizes(sizes)
128 {
129 this->setNext(nx);
130 }
131#endif
132
133 protected:
134 void setNext(ChainableTypeLayoutGenerator* nx) {
135 this->next = nx;
136 if (nx) nx->setBeginningRecursively(this->beginning);
137 }
138 void setBeginningRecursively(ChainableTypeLayoutGenerator* bg) {
139 this->beginning = bg;
140 if (this->next) this->next->setBeginningRecursively(bg);
141 }
142
143 public:
144 virtual StructLayoutInfo layoutType(SgType* t) const;
145};
146
148// Handles structs and unions only
149// Does not handle C++ stuff (inheritance, virtual functions) for now
151 public:
154 {}
155 virtual StructLayoutInfo layoutType(SgType* t) const;
156
157 private:
158 void layoutOneField(SgType* fieldType, SgNode* decl, bool isUnion /* Is type being laid out a union? */, size_t& currentOffset, StructLayoutInfo& layout) const;
159};
160
169
178
187
196
205
208 public:
210 : ChainableTypeLayoutGenerator(next,custom_sizes)
211 {}
212 virtual StructLayoutInfo layoutType(SgType* t) const;
213};
214
215
216#endif // ROSE_ABISTUFF_H
Basic type layout engine – handles bookkeeping, plus handing typedefs and.
Definition abiStuff.h:111
Layout generator for customized primitive types, mostly for UPC relying on Berkeley runtime library n...
Definition abiStuff.h:207
Layout generator for i386 primitive types.
Definition abiStuff.h:162
Slight modification for Visual Studio – doubles are 8-byte aligned.
Definition abiStuff.h:171
Layout generator for i386 ABI-like struct layout.
Definition abiStuff.h:150
This class represents the base class for all IR nodes within Sage III.
This class represents the base class for all types.
Layout generator for the native system (uses sizeof)
Definition abiStuff.h:198
Layout generator for x86-64 primitive types.
Definition abiStuff.h:180
Slight modification for Visual Studio – long is 4 bytes, not 8.
Definition abiStuff.h:189
Support for cross compilation or extended UPC support.
Definition abiStuff.h:14
size_t bitFieldContainerSize
The size of the containing element for this bit field (in bytes)
Definition abiStuff.h:86
size_t fieldSize
The size of the field or padding.
Definition abiStuff.h:84
size_t byteOffset
The byte offset of this field (or its containing word for bit fields) in the structure.
Definition abiStuff.h:82
size_t bitOffset
Offset of LSB of bit field within element of size bitFieldContainerSize starting at position byteOffs...
Definition abiStuff.h:89
SgNode * decl
If a SgInitializedName, the field represented by this entry If a SgClassDeclaration,...
Definition abiStuff.h:79
std::vector< StructLayoutEntry > fields
Fields, empty for non-compound types.
Definition abiStuff.h:101
size_t alignment
Alignment of this struct or union in bytes.
Definition abiStuff.h:99
size_t size
Size of this struct or union in bytes.
Definition abiStuff.h:97