ROSE  0.9.6a
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
abiStuff.h
Go to the documentation of this file.
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;
20  size_t sz_char;
22  size_t sz_int;
24  size_t sz_short;
26  size_t sz_long;
28  size_t sz_longlong;
30  size_t sz_float;
32  size_t sz_double;
34  size_t sz_longdouble;
36  size_t sz_pointer; // memory handle
38  size_t sz_reference;
40 
41  //Extended types beyond ABI's scope
42  size_t sz_void_ptr;
44  size_t sz_ptrdiff_t;
46  size_t sz_size_t;
48  size_t sz_wchar;
50 
51  //UPC specified sizes
52  size_t sz_shared_ptr;
54  size_t sz_pshared_ptr;
56  size_t sz_mem_handle;
58  size_t sz_reg_handle;
60 
69  size_t sz_maxblocksz;
70  };
71 
80  size_t byteOffset;
82  size_t fieldSize;
87  size_t bitOffset;
88 
90  decl(decl), byteOffset(byteOffset), fieldSize(fieldSize), bitFieldContainerSize(bitFieldContainerSize), bitOffset(bitOffset) {}
91 };
92 
95  size_t size;
97  size_t alignment;
99  std::vector<StructLayoutEntry> fields;
100 
102 };
103 
104 std::ostream& operator<<(std::ostream& o, const StructLayoutEntry& e);
105 std::ostream& operator<<(std::ostream& o, const StructLayoutInfo& i);
106 
108 // modifiers
110  public:
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:
133  this->next = nx;
134  if (nx) nx->setBeginningRecursively(this->beginning);
135  }
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 
161  public:
164  {}
165  virtual StructLayoutInfo layoutType(SgType* t) const;
166 };
167 
170  public:
173  {}
174  virtual StructLayoutInfo layoutType(SgType* t) const;
175 };
176 
179  public:
182  {}
183  virtual StructLayoutInfo layoutType(SgType* t) const;
184 };
185 
188  public:
191  {}
192  virtual StructLayoutInfo layoutType(SgType* t) const;
193 };
194 
197  public:
200  {}
201  virtual StructLayoutInfo layoutType(SgType* t) const;
202 };
203 
206  public:
208  : ChainableTypeLayoutGenerator(next,custom_sizes)
209  {}
210  virtual StructLayoutInfo layoutType(SgType* t) const;
211 };
212 
213 
214 #endif // ROSE_ABISTUFF_H