| OLD | NEW |
| 1 //===- subzero/src/IceAssembler.h - Integrated assembler --------*- C++ -*-===// | 1 //===- subzero/src/IceAssembler.h - Integrated assembler --------*- C++ -*-===// |
| 2 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 2 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 3 // for details. All rights reserved. Use of this source code is governed by a | 3 // for details. All rights reserved. Use of this source code is governed by a |
| 4 // BSD-style license that can be found in the LICENSE file. | 4 // BSD-style license that can be found in the LICENSE file. |
| 5 // | 5 // |
| 6 // Modified by the Subzero authors. | 6 // Modified by the Subzero authors. |
| 7 // | 7 // |
| 8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
| 9 // | 9 // |
| 10 // The Subzero Code Generator | 10 // The Subzero Code Generator |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 | 296 |
| 297 AssemblerTextFixup *createTextFixup(const std::string &Text, | 297 AssemblerTextFixup *createTextFixup(const std::string &Text, |
| 298 size_t BytesUsed) { | 298 size_t BytesUsed) { |
| 299 return Buffer.createTextFixup(Text, BytesUsed); | 299 return Buffer.createTextFixup(Text, BytesUsed); |
| 300 } | 300 } |
| 301 | 301 |
| 302 void setNeedsTextFixup() { Buffer.setNeedsTextFixup(); } | 302 void setNeedsTextFixup() { Buffer.setNeedsTextFixup(); } |
| 303 | 303 |
| 304 bool needsTextFixup() const { return Buffer.needsTextFixup(); } | 304 bool needsTextFixup() const { return Buffer.needsTextFixup(); } |
| 305 | 305 |
| 306 void emitIASBytes() const; | 306 void emitIASBytes(GlobalContext *Ctx) const; |
| 307 bool getInternal() const { return IsInternal; } | 307 bool getInternal() const { return IsInternal; } |
| 308 void setInternal(bool Internal) { IsInternal = Internal; } | 308 void setInternal(bool Internal) { IsInternal = Internal; } |
| 309 const IceString &getFunctionName() { return FunctionName; } | 309 const IceString &getFunctionName() { return FunctionName; } |
| 310 void setFunctionName(const IceString &NewName) { FunctionName = NewName; } | 310 void setFunctionName(const IceString &NewName) { FunctionName = NewName; } |
| 311 intptr_t getBufferSize() const { return Buffer.size(); } | 311 intptr_t getBufferSize() const { return Buffer.size(); } |
| 312 /// Roll back to a (smaller) size. | 312 /// Roll back to a (smaller) size. |
| 313 void setBufferSize(intptr_t NewSize) { Buffer.setSize(NewSize); } | 313 void setBufferSize(intptr_t NewSize) { Buffer.setSize(NewSize); } |
| 314 void setPreliminary(bool Value) { Preliminary = Value; } | 314 void setPreliminary(bool Value) { Preliminary = Value; } |
| 315 bool getPreliminary() const { return Preliminary; } | 315 bool getPreliminary() const { return Preliminary; } |
| 316 | 316 |
| 317 AssemblerKind getKind() const { return Kind; } | 317 AssemblerKind getKind() const { return Kind; } |
| 318 | 318 |
| 319 protected: | 319 protected: |
| 320 explicit Assembler(AssemblerKind Kind, GlobalContext *Ctx) | 320 explicit Assembler(AssemblerKind Kind) |
| 321 : Kind(Kind), Allocator(), Ctx(Ctx), Buffer(*this) {} | 321 : Kind(Kind), Allocator(), Buffer(*this) {} |
| 322 | 322 |
| 323 private: | 323 private: |
| 324 const AssemblerKind Kind; | 324 const AssemblerKind Kind; |
| 325 | 325 |
| 326 ArenaAllocator<32 * 1024> Allocator; | 326 ArenaAllocator<32 * 1024> Allocator; |
| 327 /// FunctionName and IsInternal are transferred from the original Cfg object, | 327 /// FunctionName and IsInternal are transferred from the original Cfg object, |
| 328 /// since the Cfg object may be deleted by the time the assembler buffer is | 328 /// since the Cfg object may be deleted by the time the assembler buffer is |
| 329 /// emitted. | 329 /// emitted. |
| 330 IceString FunctionName = ""; | 330 IceString FunctionName = ""; |
| 331 bool IsInternal = false; | 331 bool IsInternal = false; |
| 332 /// Preliminary indicates whether a preliminary pass is being made for | 332 /// Preliminary indicates whether a preliminary pass is being made for |
| 333 /// calculating bundle padding (Preliminary=true), versus the final pass where | 333 /// calculating bundle padding (Preliminary=true), versus the final pass where |
| 334 /// all changes to label bindings, label links, and relocation fixups are | 334 /// all changes to label bindings, label links, and relocation fixups are |
| 335 /// fully committed (Preliminary=false). | 335 /// fully committed (Preliminary=false). |
| 336 bool Preliminary = false; | 336 bool Preliminary = false; |
| 337 | 337 |
| 338 /// Installs a created fixup, after it has been allocated. | 338 /// Installs a created fixup, after it has been allocated. |
| 339 void installFixup(AssemblerFixup *F) { Buffer.installFixup(F); } | 339 void installFixup(AssemblerFixup *F) { Buffer.installFixup(F); } |
| 340 | 340 |
| 341 protected: | 341 protected: |
| 342 GlobalContext *Ctx; | |
| 343 // Buffer's constructor uses the Allocator, so it needs to appear after it. | 342 // Buffer's constructor uses the Allocator, so it needs to appear after it. |
| 344 // TODO(jpp): dependencies on construction order are a nice way of shooting | 343 // TODO(jpp): dependencies on construction order are a nice way of shooting |
| 345 // yourself in the foot. Fix this. | 344 // yourself in the foot. Fix this. |
| 346 AssemblerBuffer Buffer; | 345 AssemblerBuffer Buffer; |
| 347 }; | 346 }; |
| 348 | 347 |
| 349 } // end of namespace Ice | 348 } // end of namespace Ice |
| 350 | 349 |
| 351 #endif // SUBZERO_SRC_ICEASSEMBLER_H_ | 350 #endif // SUBZERO_SRC_ICEASSEMBLER_H_ |
| OLD | NEW |