| 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 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 | 303 |
| 304 AssemblerTextFixup *createTextFixup(const std::string &Text, | 304 AssemblerTextFixup *createTextFixup(const std::string &Text, |
| 305 size_t BytesUsed) { | 305 size_t BytesUsed) { |
| 306 return Buffer.createTextFixup(Text, BytesUsed); | 306 return Buffer.createTextFixup(Text, BytesUsed); |
| 307 } | 307 } |
| 308 | 308 |
| 309 void setNeedsTextFixup() { Buffer.setNeedsTextFixup(); } | 309 void setNeedsTextFixup() { Buffer.setNeedsTextFixup(); } |
| 310 | 310 |
| 311 bool needsTextFixup() const { return Buffer.needsTextFixup(); } | 311 bool needsTextFixup() const { return Buffer.needsTextFixup(); } |
| 312 | 312 |
| 313 void emitIASBytes() const; | 313 void emitIASBytes(GlobalContext *Ctx) const; |
| 314 bool getInternal() const { return IsInternal; } | 314 bool getInternal() const { return IsInternal; } |
| 315 void setInternal(bool Internal) { IsInternal = Internal; } | 315 void setInternal(bool Internal) { IsInternal = Internal; } |
| 316 const IceString &getFunctionName() { return FunctionName; } | 316 const IceString &getFunctionName() { return FunctionName; } |
| 317 void setFunctionName(const IceString &NewName) { FunctionName = NewName; } | 317 void setFunctionName(const IceString &NewName) { FunctionName = NewName; } |
| 318 intptr_t getBufferSize() const { return Buffer.size(); } | 318 intptr_t getBufferSize() const { return Buffer.size(); } |
| 319 /// Roll back to a (smaller) size. | 319 /// Roll back to a (smaller) size. |
| 320 void setBufferSize(intptr_t NewSize) { Buffer.setSize(NewSize); } | 320 void setBufferSize(intptr_t NewSize) { Buffer.setSize(NewSize); } |
| 321 void setPreliminary(bool Value) { Preliminary = Value; } | 321 void setPreliminary(bool Value) { Preliminary = Value; } |
| 322 bool getPreliminary() const { return Preliminary; } | 322 bool getPreliminary() const { return Preliminary; } |
| 323 | 323 |
| 324 AssemblerKind getKind() const { return Kind; } | 324 AssemblerKind getKind() const { return Kind; } |
| 325 | 325 |
| 326 protected: | 326 protected: |
| 327 explicit Assembler(AssemblerKind Kind, GlobalContext *Ctx) | 327 explicit Assembler(AssemblerKind Kind) |
| 328 : Kind(Kind), Allocator(), Ctx(Ctx), Buffer(*this) {} | 328 : Kind(Kind), Allocator(), Buffer(*this) {} |
| 329 | 329 |
| 330 private: | 330 private: |
| 331 const AssemblerKind Kind; | 331 const AssemblerKind Kind; |
| 332 | 332 |
| 333 ArenaAllocator<32 * 1024> Allocator; | 333 ArenaAllocator<32 * 1024> Allocator; |
| 334 /// FunctionName and IsInternal are transferred from the original Cfg object, | 334 /// FunctionName and IsInternal are transferred from the original Cfg object, |
| 335 /// since the Cfg object may be deleted by the time the assembler buffer is | 335 /// since the Cfg object may be deleted by the time the assembler buffer is |
| 336 /// emitted. | 336 /// emitted. |
| 337 IceString FunctionName = ""; | 337 IceString FunctionName = ""; |
| 338 bool IsInternal = false; | 338 bool IsInternal = false; |
| 339 /// Preliminary indicates whether a preliminary pass is being made for | 339 /// Preliminary indicates whether a preliminary pass is being made for |
| 340 /// calculating bundle padding (Preliminary=true), versus the final pass where | 340 /// calculating bundle padding (Preliminary=true), versus the final pass where |
| 341 /// all changes to label bindings, label links, and relocation fixups are | 341 /// all changes to label bindings, label links, and relocation fixups are |
| 342 /// fully committed (Preliminary=false). | 342 /// fully committed (Preliminary=false). |
| 343 bool Preliminary = false; | 343 bool Preliminary = false; |
| 344 | 344 |
| 345 /// Installs a created fixup, after it has been allocated. | 345 /// Installs a created fixup, after it has been allocated. |
| 346 void installFixup(AssemblerFixup *F) { Buffer.installFixup(F); } | 346 void installFixup(AssemblerFixup *F) { Buffer.installFixup(F); } |
| 347 | 347 |
| 348 protected: | 348 protected: |
| 349 GlobalContext *Ctx; | |
| 350 // Buffer's constructor uses the Allocator, so it needs to appear after it. | 349 // Buffer's constructor uses the Allocator, so it needs to appear after it. |
| 351 // TODO(jpp): dependencies on construction order are a nice way of shooting | 350 // TODO(jpp): dependencies on construction order are a nice way of shooting |
| 352 // yourself in the foot. Fix this. | 351 // yourself in the foot. Fix this. |
| 353 AssemblerBuffer Buffer; | 352 AssemblerBuffer Buffer; |
| 354 }; | 353 }; |
| 355 | 354 |
| 356 } // end of namespace Ice | 355 } // end of namespace Ice |
| 357 | 356 |
| 358 #endif // SUBZERO_SRC_ICEASSEMBLER_H_ | 357 #endif // SUBZERO_SRC_ICEASSEMBLER_H_ |
| OLD | NEW |