| OLD | NEW |
| 1 //===- subzero/src/assembler.h - Integrated assembler -----------*- C++ -*-===// | 1 //===- subzero/src/assembler.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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 public: | 44 public: |
| 45 | 45 |
| 46 // It would be ideal if the destructor method could be made private, | 46 // It would be ideal if the destructor method could be made private, |
| 47 // but the g++ compiler complains when this is subclassed. | 47 // but the g++ compiler complains when this is subclassed. |
| 48 virtual ~AssemblerFixup() { llvm_unreachable("~AssemblerFixup used"); } | 48 virtual ~AssemblerFixup() { llvm_unreachable("~AssemblerFixup used"); } |
| 49 | 49 |
| 50 intptr_t position() const { return position_; } | 50 intptr_t position() const { return position_; } |
| 51 | 51 |
| 52 FixupKind kind() const { return kind_; } | 52 FixupKind kind() const { return kind_; } |
| 53 | 53 |
| 54 const ConstantRelocatable *value() const { return value_; } | 54 RelocOffsetT offset() const; |
| 55 |
| 56 IceString symbol(GlobalContext *Ctx) const; |
| 57 |
| 58 void emit(GlobalContext *Ctx) const; |
| 55 | 59 |
| 56 protected: | 60 protected: |
| 57 AssemblerFixup(FixupKind Kind, const ConstantRelocatable *Value) | 61 AssemblerFixup(FixupKind Kind, const Constant *Value) |
| 58 : position_(0), kind_(Kind), value_(Value) {} | 62 : position_(0), kind_(Kind), value_(Value) {} |
| 59 | 63 |
| 60 private: | 64 private: |
| 61 intptr_t position_; | 65 intptr_t position_; |
| 62 FixupKind kind_; | 66 FixupKind kind_; |
| 63 const ConstantRelocatable *value_; | 67 const Constant *value_; |
| 64 | 68 |
| 65 void set_position(intptr_t position) { position_ = position; } | 69 void set_position(intptr_t position) { position_ = position; } |
| 66 | 70 |
| 67 friend class AssemblerBuffer; | 71 friend class AssemblerBuffer; |
| 68 }; | 72 }; |
| 69 | 73 |
| 70 // Assembler buffers are used to emit binary code. They grow on demand. | 74 // Assembler buffers are used to emit binary code. They grow on demand. |
| 71 class AssemblerBuffer { | 75 class AssemblerBuffer { |
| 72 AssemblerBuffer(const AssemblerBuffer &) = delete; | 76 AssemblerBuffer(const AssemblerBuffer &) = delete; |
| 73 AssemblerBuffer &operator=(const AssemblerBuffer &) = delete; | 77 AssemblerBuffer &operator=(const AssemblerBuffer &) = delete; |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 // Mark the current text location as the start of a CFG node | 227 // Mark the current text location as the start of a CFG node |
| 224 // (represented by NodeNumber). | 228 // (represented by NodeNumber). |
| 225 virtual void BindCfgNodeLabel(SizeT NodeNumber) = 0; | 229 virtual void BindCfgNodeLabel(SizeT NodeNumber) = 0; |
| 226 | 230 |
| 227 // Return a view of all the bytes of code for the current function. | 231 // Return a view of all the bytes of code for the current function. |
| 228 llvm::StringRef getBufferView() const; | 232 llvm::StringRef getBufferView() const; |
| 229 | 233 |
| 230 void emitIASBytes(GlobalContext *Ctx) const; | 234 void emitIASBytes(GlobalContext *Ctx) const; |
| 231 | 235 |
| 232 private: | 236 private: |
| 233 ArenaAllocator Allocator; | 237 ArenaAllocator<32 * 1024> Allocator; |
| 234 | 238 |
| 235 protected: | 239 protected: |
| 236 AssemblerBuffer buffer_; | 240 AssemblerBuffer buffer_; |
| 237 }; | 241 }; |
| 238 | 242 |
| 239 } // end of namespace Ice | 243 } // end of namespace Ice |
| 240 | 244 |
| 241 #endif // SUBZERO_SRC_ASSEMBLER_H_ | 245 #endif // SUBZERO_SRC_ASSEMBLER_H_ |
| OLD | NEW |