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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 Legal_Reg = 1 << 0, // physical register, not stack location | 140 Legal_Reg = 1 << 0, // physical register, not stack location |
141 Legal_Imm = 1 << 1, | 141 Legal_Imm = 1 << 1, |
142 Legal_Mem = 1 << 2, // includes [eax+4*ecx] as well as [esp+12] | 142 Legal_Mem = 1 << 2, // includes [eax+4*ecx] as well as [esp+12] |
143 // TODO(stichnot): LEAHACK: remove Legal_Reloc once a proper | 143 // TODO(stichnot): LEAHACK: remove Legal_Reloc once a proper |
144 // emitter is used. | 144 // emitter is used. |
145 Legal_Reloc = 1 << 3, | 145 Legal_Reloc = 1 << 3, |
146 Legal_All = ~Legal_None | 146 Legal_All = ~Legal_None |
147 }; | 147 }; |
148 typedef uint32_t LegalMask; | 148 typedef uint32_t LegalMask; |
149 Operand *legalize(Operand *From, LegalMask Allowed = Legal_All & ~Legal_Reloc, | 149 Operand *legalize(Operand *From, LegalMask Allowed = Legal_All & ~Legal_Reloc, |
150 bool AllowOverlap = false, | |
151 int32_t RegNum = Variable::NoRegister); | 150 int32_t RegNum = Variable::NoRegister); |
152 Variable *legalizeToVar(Operand *From, bool AllowOverlap = false, | 151 Variable *legalizeToVar(Operand *From, int32_t RegNum = Variable::NoRegister); |
153 int32_t RegNum = Variable::NoRegister); | |
154 // Turn a pointer operand into a memory operand that can be | 152 // Turn a pointer operand into a memory operand that can be |
155 // used by a real load/store operation. Legalizes the operand as well. | 153 // used by a real load/store operation. Legalizes the operand as well. |
156 // This is a nop if the operand is already a legal memory operand. | 154 // This is a nop if the operand is already a legal memory operand. |
157 OperandX8632Mem *FormMemoryOperand(Operand *Ptr, Type Ty); | 155 OperandX8632Mem *FormMemoryOperand(Operand *Ptr, Type Ty); |
158 | 156 |
159 Variable *makeReg(Type Ty, int32_t RegNum = Variable::NoRegister); | 157 Variable *makeReg(Type Ty, int32_t RegNum = Variable::NoRegister); |
160 InstCall *makeHelperCall(const IceString &Name, Variable *Dest, | 158 InstCall *makeHelperCall(const IceString &Name, Variable *Dest, |
161 SizeT MaxSrcs) { | 159 SizeT MaxSrcs) { |
162 bool SuppressMangling = true; | 160 bool SuppressMangling = true; |
163 const Type FunctionPointerType = IceType_i32; | 161 const Type FunctionPointerType = IceType_i32; |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 } | 288 } |
291 void _lea(Variable *Dest, Operand *Src0) { | 289 void _lea(Variable *Dest, Operand *Src0) { |
292 Context.insert(InstX8632Lea::create(Func, Dest, Src0)); | 290 Context.insert(InstX8632Lea::create(Func, Dest, Src0)); |
293 } | 291 } |
294 void _mfence() { Context.insert(InstX8632Mfence::create(Func)); } | 292 void _mfence() { Context.insert(InstX8632Mfence::create(Func)); } |
295 // If Dest=NULL is passed in, then a new variable is created, marked | 293 // If Dest=NULL is passed in, then a new variable is created, marked |
296 // as infinite register allocation weight, and returned through the | 294 // as infinite register allocation weight, and returned through the |
297 // in/out Dest argument. | 295 // in/out Dest argument. |
298 void _mov(Variable *&Dest, Operand *Src0, | 296 void _mov(Variable *&Dest, Operand *Src0, |
299 int32_t RegNum = Variable::NoRegister) { | 297 int32_t RegNum = Variable::NoRegister) { |
300 if (Dest == NULL) { | 298 if (Dest == NULL) |
301 Dest = legalizeToVar(Src0, false, RegNum); | 299 Dest = makeReg(Src0->getType(), RegNum); |
302 } else { | 300 Context.insert(InstX8632Mov::create(Func, Dest, Src0)); |
303 Context.insert(InstX8632Mov::create(Func, Dest, Src0)); | |
304 } | |
305 } | 301 } |
306 void _movd(Variable *Dest, Operand *Src0) { | 302 void _movd(Variable *Dest, Operand *Src0) { |
307 Context.insert(InstX8632Movd::create(Func, Dest, Src0)); | 303 Context.insert(InstX8632Movd::create(Func, Dest, Src0)); |
308 } | 304 } |
309 void _movp(Variable *Dest, Operand *Src0) { | 305 void _movp(Variable *Dest, Operand *Src0) { |
310 Context.insert(InstX8632Movp::create(Func, Dest, Src0)); | 306 Context.insert(InstX8632Movp::create(Func, Dest, Src0)); |
311 } | 307 } |
312 void _movq(Variable *Dest, Operand *Src0) { | 308 void _movq(Variable *Dest, Operand *Src0) { |
313 Context.insert(InstX8632Movq::create(Func, Dest, Src0)); | 309 Context.insert(InstX8632Movq::create(Func, Dest, Src0)); |
314 } | 310 } |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 }; | 501 }; |
506 | 502 |
507 template <> void ConstantInteger32::emit(GlobalContext *Ctx) const; | 503 template <> void ConstantInteger32::emit(GlobalContext *Ctx) const; |
508 template <> void ConstantInteger64::emit(GlobalContext *Ctx) const; | 504 template <> void ConstantInteger64::emit(GlobalContext *Ctx) const; |
509 template <> void ConstantFloat::emit(GlobalContext *Ctx) const; | 505 template <> void ConstantFloat::emit(GlobalContext *Ctx) const; |
510 template <> void ConstantDouble::emit(GlobalContext *Ctx) const; | 506 template <> void ConstantDouble::emit(GlobalContext *Ctx) const; |
511 | 507 |
512 } // end of namespace Ice | 508 } // end of namespace Ice |
513 | 509 |
514 #endif // SUBZERO_SRC_ICETARGETLOWERINGX8632_H | 510 #endif // SUBZERO_SRC_ICETARGETLOWERINGX8632_H |
OLD | NEW |