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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 virtual void postLower(); | 76 virtual void postLower(); |
77 | 77 |
78 virtual void lowerAlloca(const InstAlloca *Inst); | 78 virtual void lowerAlloca(const InstAlloca *Inst); |
79 virtual void lowerArithmetic(const InstArithmetic *Inst); | 79 virtual void lowerArithmetic(const InstArithmetic *Inst); |
80 virtual void lowerAssign(const InstAssign *Inst); | 80 virtual void lowerAssign(const InstAssign *Inst); |
81 virtual void lowerBr(const InstBr *Inst); | 81 virtual void lowerBr(const InstBr *Inst); |
82 virtual void lowerCall(const InstCall *Inst); | 82 virtual void lowerCall(const InstCall *Inst); |
83 virtual void lowerCast(const InstCast *Inst); | 83 virtual void lowerCast(const InstCast *Inst); |
84 virtual void lowerFcmp(const InstFcmp *Inst); | 84 virtual void lowerFcmp(const InstFcmp *Inst); |
85 virtual void lowerIcmp(const InstIcmp *Inst); | 85 virtual void lowerIcmp(const InstIcmp *Inst); |
| 86 virtual void lowerIntrinsicCall(const InstIntrinsicCall *Inst); |
86 virtual void lowerLoad(const InstLoad *Inst); | 87 virtual void lowerLoad(const InstLoad *Inst); |
87 virtual void lowerPhi(const InstPhi *Inst); | 88 virtual void lowerPhi(const InstPhi *Inst); |
88 virtual void lowerRet(const InstRet *Inst); | 89 virtual void lowerRet(const InstRet *Inst); |
89 virtual void lowerSelect(const InstSelect *Inst); | 90 virtual void lowerSelect(const InstSelect *Inst); |
90 virtual void lowerStore(const InstStore *Inst); | 91 virtual void lowerStore(const InstStore *Inst); |
91 virtual void lowerSwitch(const InstSwitch *Inst); | 92 virtual void lowerSwitch(const InstSwitch *Inst); |
92 virtual void lowerUnreachable(const InstUnreachable *Inst); | 93 virtual void lowerUnreachable(const InstUnreachable *Inst); |
93 virtual void doAddressOptLoad(); | 94 virtual void doAddressOptLoad(); |
94 virtual void doAddressOptStore(); | 95 virtual void doAddressOptStore(); |
95 | 96 |
(...skipping 20 matching lines...) Expand all Loading... |
116 | 117 |
117 Variable *makeReg(Type Ty, int32_t RegNum = Variable::NoRegister); | 118 Variable *makeReg(Type Ty, int32_t RegNum = Variable::NoRegister); |
118 InstCall *makeHelperCall(const IceString &Name, Variable *Dest, | 119 InstCall *makeHelperCall(const IceString &Name, Variable *Dest, |
119 SizeT MaxSrcs) { | 120 SizeT MaxSrcs) { |
120 bool SuppressMangling = true; | 121 bool SuppressMangling = true; |
121 Type Ty = Dest ? Dest->getType() : IceType_void; | 122 Type Ty = Dest ? Dest->getType() : IceType_void; |
122 Constant *CallTarget = Ctx->getConstantSym(Ty, 0, Name, SuppressMangling); | 123 Constant *CallTarget = Ctx->getConstantSym(Ty, 0, Name, SuppressMangling); |
123 InstCall *Call = InstCall::create(Func, MaxSrcs, Dest, CallTarget); | 124 InstCall *Call = InstCall::create(Func, MaxSrcs, Dest, CallTarget); |
124 return Call; | 125 return Call; |
125 } | 126 } |
| 127 Type stackSlotType() const { |
| 128 return IceType_i32; |
| 129 } |
126 | 130 |
127 // The following are helpers that insert lowered x86 instructions | 131 // The following are helpers that insert lowered x86 instructions |
128 // with minimal syntactic overhead, so that the lowering code can | 132 // with minimal syntactic overhead, so that the lowering code can |
129 // look as close to assembly as practical. | 133 // look as close to assembly as practical. |
130 void _adc(Variable *Dest, Operand *Src0) { | 134 void _adc(Variable *Dest, Operand *Src0) { |
131 Context.insert(InstX8632Adc::create(Func, Dest, Src0)); | 135 Context.insert(InstX8632Adc::create(Func, Dest, Src0)); |
132 } | 136 } |
133 void _add(Variable *Dest, Operand *Src0) { | 137 void _add(Variable *Dest, Operand *Src0) { |
134 Context.insert(InstX8632Add::create(Func, Dest, Src0)); | 138 Context.insert(InstX8632Add::create(Func, Dest, Src0)); |
135 } | 139 } |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 } | 243 } |
240 void _subss(Variable *Dest, Operand *Src0) { | 244 void _subss(Variable *Dest, Operand *Src0) { |
241 Context.insert(InstX8632Subss::create(Func, Dest, Src0)); | 245 Context.insert(InstX8632Subss::create(Func, Dest, Src0)); |
242 } | 246 } |
243 void _test(Operand *Src0, Operand *Src1) { | 247 void _test(Operand *Src0, Operand *Src1) { |
244 Context.insert(InstX8632Test::create(Func, Src0, Src1)); | 248 Context.insert(InstX8632Test::create(Func, Src0, Src1)); |
245 } | 249 } |
246 void _ucomiss(Operand *Src0, Operand *Src1) { | 250 void _ucomiss(Operand *Src0, Operand *Src1) { |
247 Context.insert(InstX8632Ucomiss::create(Func, Src0, Src1)); | 251 Context.insert(InstX8632Ucomiss::create(Func, Src0, Src1)); |
248 } | 252 } |
| 253 void _ud2() { |
| 254 Context.insert(InstX8632UD2::create(Func)); |
| 255 } |
249 void _xor(Variable *Dest, Operand *Src0) { | 256 void _xor(Variable *Dest, Operand *Src0) { |
250 Context.insert(InstX8632Xor::create(Func, Dest, Src0)); | 257 Context.insert(InstX8632Xor::create(Func, Dest, Src0)); |
251 } | 258 } |
252 | 259 |
253 bool IsEbpBasedFrame; | 260 bool IsEbpBasedFrame; |
254 size_t FrameSizeLocals; | 261 size_t FrameSizeLocals; |
255 size_t LocalsSizeBytes; | 262 size_t LocalsSizeBytes; |
256 llvm::SmallBitVector TypeToRegisterSet[IceType_NUM]; | 263 llvm::SmallBitVector TypeToRegisterSet[IceType_NUM]; |
257 llvm::SmallBitVector ScratchRegs; | 264 llvm::SmallBitVector ScratchRegs; |
258 llvm::SmallBitVector RegsUsed; | 265 llvm::SmallBitVector RegsUsed; |
259 SizeT NextLabelNumber; | 266 SizeT NextLabelNumber; |
260 bool ComputedLiveRanges; | 267 bool ComputedLiveRanges; |
261 VarList PhysicalRegisters; | 268 VarList PhysicalRegisters; |
262 static IceString RegNames[]; | 269 static IceString RegNames[]; |
263 | 270 |
264 private: | 271 private: |
265 TargetX8632(const TargetX8632 &) LLVM_DELETED_FUNCTION; | 272 TargetX8632(const TargetX8632 &) LLVM_DELETED_FUNCTION; |
266 TargetX8632 &operator=(const TargetX8632 &) LLVM_DELETED_FUNCTION; | 273 TargetX8632 &operator=(const TargetX8632 &) LLVM_DELETED_FUNCTION; |
267 virtual ~TargetX8632() {} | 274 virtual ~TargetX8632() {} |
268 template <typename T> void emitConstantPool() const; | 275 template <typename T> void emitConstantPool() const; |
269 }; | 276 }; |
270 | 277 |
271 template <> void ConstantFloat::emit(GlobalContext *Ctx) const; | 278 template <> void ConstantFloat::emit(GlobalContext *Ctx) const; |
272 template <> void ConstantDouble::emit(GlobalContext *Ctx) const; | 279 template <> void ConstantDouble::emit(GlobalContext *Ctx) const; |
273 | 280 |
274 } // end of namespace Ice | 281 } // end of namespace Ice |
275 | 282 |
276 #endif // SUBZERO_SRC_ICETARGETLOWERINGX8632_H | 283 #endif // SUBZERO_SRC_ICETARGETLOWERINGX8632_H |
OLD | NEW |