OLD | NEW |
1 //===- subzero/src/IceTargetLoweringX8632.h - x86-32 lowering ---*- C++ -*-===// | 1 //===- subzero/src/IceTargetLoweringX8632.h - x86-32 lowering ---*- C++ -*-===// |
2 // | 2 // |
3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 // | 9 // |
10 // This file declares the TargetLoweringX8632 class, which | 10 // This file declares the TargetLoweringX8632 class, which |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 // instructions that guarantee that the Operand kind is one of those | 102 // instructions that guarantee that the Operand kind is one of those |
103 // indicated by the LegalMask (a bitmask of allowed kinds). If the | 103 // indicated by the LegalMask (a bitmask of allowed kinds). If the |
104 // input Operand is known to already meet the constraints, it may be | 104 // input Operand is known to already meet the constraints, it may be |
105 // simply returned as the result, without creating any new | 105 // simply returned as the result, without creating any new |
106 // instructions or operands. | 106 // instructions or operands. |
107 enum OperandLegalization { | 107 enum OperandLegalization { |
108 Legal_None = 0, | 108 Legal_None = 0, |
109 Legal_Reg = 1 << 0, // physical register, not stack location | 109 Legal_Reg = 1 << 0, // physical register, not stack location |
110 Legal_Imm = 1 << 1, | 110 Legal_Imm = 1 << 1, |
111 Legal_Mem = 1 << 2, // includes [eax+4*ecx] as well as [esp+12] | 111 Legal_Mem = 1 << 2, // includes [eax+4*ecx] as well as [esp+12] |
| 112 // TODO(stichnot): LEAHACK: remove Legal_Reloc once a proper |
| 113 // emitter is used. |
| 114 Legal_Reloc = 1 << 3, |
112 Legal_All = ~Legal_None | 115 Legal_All = ~Legal_None |
113 }; | 116 }; |
114 typedef uint32_t LegalMask; | 117 typedef uint32_t LegalMask; |
115 Operand *legalize(Operand *From, LegalMask Allowed = Legal_All, | 118 Operand *legalize(Operand *From, LegalMask Allowed = Legal_All & ~Legal_Reloc, |
116 bool AllowOverlap = false, | 119 bool AllowOverlap = false, |
117 int32_t RegNum = Variable::NoRegister); | 120 int32_t RegNum = Variable::NoRegister); |
118 Variable *legalizeToVar(Operand *From, bool AllowOverlap = false, | 121 Variable *legalizeToVar(Operand *From, bool AllowOverlap = false, |
119 int32_t RegNum = Variable::NoRegister); | 122 int32_t RegNum = Variable::NoRegister); |
120 // Turn a pointer operand into a memory operand that can be | 123 // Turn a pointer operand into a memory operand that can be |
121 // used by a real load/store operation. Legalizes the operand as well. | 124 // used by a real load/store operation. Legalizes the operand as well. |
122 // This is a nop if the operand is already a legal memory operand. | 125 // This is a nop if the operand is already a legal memory operand. |
123 OperandX8632Mem *FormMemoryOperand(Operand *Ptr, Type Ty); | 126 OperandX8632Mem *FormMemoryOperand(Operand *Ptr, Type Ty); |
124 | 127 |
125 Variable *makeReg(Type Ty, int32_t RegNum = Variable::NoRegister); | 128 Variable *makeReg(Type Ty, int32_t RegNum = Variable::NoRegister); |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 VarList PhysicalRegisters; | 287 VarList PhysicalRegisters; |
285 static IceString RegNames[]; | 288 static IceString RegNames[]; |
286 | 289 |
287 private: | 290 private: |
288 TargetX8632(const TargetX8632 &) LLVM_DELETED_FUNCTION; | 291 TargetX8632(const TargetX8632 &) LLVM_DELETED_FUNCTION; |
289 TargetX8632 &operator=(const TargetX8632 &) LLVM_DELETED_FUNCTION; | 292 TargetX8632 &operator=(const TargetX8632 &) LLVM_DELETED_FUNCTION; |
290 virtual ~TargetX8632() {} | 293 virtual ~TargetX8632() {} |
291 template <typename T> void emitConstantPool() const; | 294 template <typename T> void emitConstantPool() const; |
292 }; | 295 }; |
293 | 296 |
| 297 class TargetGlobalInitX8632 : public TargetGlobalInitLowering { |
| 298 public: |
| 299 static TargetGlobalInitLowering *create(GlobalContext *Ctx) { |
| 300 return new TargetGlobalInitX8632(Ctx); |
| 301 } |
| 302 virtual void lower(const IceString &Name, SizeT Align, bool IsInternal, |
| 303 bool IsConst, bool IsZeroInitializer, SizeT Size, |
| 304 const char *Data, bool DisableTranslation); |
| 305 |
| 306 protected: |
| 307 TargetGlobalInitX8632(GlobalContext *Ctx); |
| 308 |
| 309 private: |
| 310 TargetGlobalInitX8632(const TargetGlobalInitX8632 &) LLVM_DELETED_FUNCTION; |
| 311 TargetGlobalInitX8632 & |
| 312 operator=(const TargetGlobalInitX8632 &) LLVM_DELETED_FUNCTION; |
| 313 virtual ~TargetGlobalInitX8632() {} |
| 314 }; |
| 315 |
294 template <> void ConstantFloat::emit(GlobalContext *Ctx) const; | 316 template <> void ConstantFloat::emit(GlobalContext *Ctx) const; |
295 template <> void ConstantDouble::emit(GlobalContext *Ctx) const; | 317 template <> void ConstantDouble::emit(GlobalContext *Ctx) const; |
296 | 318 |
297 } // end of namespace Ice | 319 } // end of namespace Ice |
298 | 320 |
299 #endif // SUBZERO_SRC_ICETARGETLOWERINGX8632_H | 321 #endif // SUBZERO_SRC_ICETARGETLOWERINGX8632_H |
OLD | NEW |