ROSE 0.11.145.192
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_double;
33 size_t sz_alignof_double;
34 size_t sz_longdouble;
35 size_t sz_alignof_longdouble;
36 size_t sz_pointer; // memory handle
37 size_t sz_alignof_pointer;
38 size_t sz_reference;
39 size_t sz_alignof_reference;
40
41 //Extended types beyond ABI's scope
42 size_t sz_void_ptr;
43 size_t sz_alignof_void_ptr;
44 size_t sz_ptrdiff_t;
45 size_t sz_alignof_ptrdiff_t;
46 size_t sz_size_t;
47 size_t sz_alignof_size_t;
48 size_t sz_wchar;
49 size_t sz_alignof_wchar;
50
51 //UPC specified sizes
52 size_t sz_shared_ptr;
53 size_t sz_alignof_shared_ptr;
54 size_t sz_pshared_ptr;
55 size_t sz_alignof_pshared_ptr;
56 size_t sz_mem_handle;
57 size_t sz_alignof_mem_handle;
58 size_t sz_reg_handle;
59 size_t sz_alignof_reg_handle;
60
61 size_t sz_alignof_dbl_1st;
62 size_t sz_alignof_int64_1st;
63 size_t sz_alignof_sharedptr_1st ;
64 size_t sz_alignof_psharedptr_1st ;
65 size_t sz_alignof_dbl_innerstruct;
66 size_t sz_alignof_int64_innerstruct;
67 size_t sz_alignof_sharedptr_innerstruct ;
68 size_t sz_alignof_psharedptr_innerstruct;
69 size_t sz_maxblocksz;
70 };
71
92
95 size_t size;
97 size_t alignment;
99 std::vector<StructLayoutEntry> fields;
100
101 StructLayoutInfo(): size(0), alignment(0), fields() {}
102};
103
104std::ostream& operator<<(std::ostream& o, const StructLayoutEntry& e);
105std::ostream& operator<<(std::ostream& o, const StructLayoutInfo& i);
106
108// modifiers
110 public:
114 StructCustomizedSizes* custom_sizes;
115
117#ifdef _MSC_VER
118 : next(NULL), beginning(NULL), custom_sizes(sizes)
119 {
120 // DQ (11/27/2009): MSVC reports a warning when "this" is used in the preinitialization list.
121 beginning = this;
122 this->setNext(nx);
123 }
124#else
125 : next(NULL), beginning(this), custom_sizes(sizes)
126 {
127 this->setNext(nx);
128 }
129#endif
130
131 protected:
132 void setNext(ChainableTypeLayoutGenerator* nx) {
133 this->next = nx;
134 if (nx) nx->setBeginningRecursively(this->beginning);
135 }
136 void setBeginningRecursively(ChainableTypeLayoutGenerator* bg) {
137 this->beginning = bg;
138 if (this->next) this->next->setBeginningRecursively(bg);
139 }
140
141 public:
142 virtual StructLayoutInfo layoutType(SgType* t) const;
143};
144
146// Handles structs and unions only
147// Does not handle C++ stuff (inheritance, virtual functions) for now
149 public:
152 {}
153 virtual StructLayoutInfo layoutType(SgType* t) const;
154
155 private:
156 void layoutOneField(SgType* fieldType, SgNode* decl, bool isUnion /* Is type being laid out a union? */, size_t& currentOffset, StructLayoutInfo& layout) const;
157};
158
167
176
185
194
203
206 public:
208 : ChainableTypeLayoutGenerator(next,custom_sizes)
209 {}
210 virtual StructLayoutInfo layoutType(SgType* t) const;
211};
212
213
214#endif // ROSE_ABISTUFF_H
Basic type layout engine – handles bookkeeping, plus handing typedefs and.
Definition abiStuff.h:109
Layout generator for customized primitive types, mostly for UPC relying on Berkeley runtime library n...
Definition abiStuff.h:205
Layout generator for i386 primitive types.
Definition abiStuff.h:160
Slight modification for Visual Studio – doubles are 8-byte aligned.
Definition abiStuff.h:169
Layout generator for i386 ABI-like struct layout.
Definition abiStuff.h:148
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:196
Layout generator for x86-64 primitive types.
Definition abiStuff.h:178
Slight modification for Visual Studio – long is 4 bytes, not 8.
Definition abiStuff.h:187
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:84
size_t fieldSize
The size of the field or padding.
Definition abiStuff.h:82
size_t byteOffset
The byte offset of this field (or its containing word for bit fields) in the structure.
Definition abiStuff.h:80
size_t bitOffset
Offset of LSB of bit field within element of size bitFieldContainerSize starting at position byteOffs...
Definition abiStuff.h:87
SgNode * decl
If a SgInitializedName, the field represented by this entry If a SgClassDeclaration,...
Definition abiStuff.h:77
std::vector< StructLayoutEntry > fields
Fields, empty for non-compound types.
Definition abiStuff.h:99
size_t alignment
Alignment of this struct or union in bytes.
Definition abiStuff.h:97
size_t size
Size of this struct or union in bytes.
Definition abiStuff.h:95