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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 TargetX8632(Cfg *Func); | 75 TargetX8632(Cfg *Func); |
76 | 76 |
77 virtual void postLower(); | 77 virtual void postLower(); |
78 | 78 |
79 virtual void lowerAlloca(const InstAlloca *Inst); | 79 virtual void lowerAlloca(const InstAlloca *Inst); |
80 virtual void lowerArithmetic(const InstArithmetic *Inst); | 80 virtual void lowerArithmetic(const InstArithmetic *Inst); |
81 virtual void lowerAssign(const InstAssign *Inst); | 81 virtual void lowerAssign(const InstAssign *Inst); |
82 virtual void lowerBr(const InstBr *Inst); | 82 virtual void lowerBr(const InstBr *Inst); |
83 virtual void lowerCall(const InstCall *Inst); | 83 virtual void lowerCall(const InstCall *Inst); |
84 virtual void lowerCast(const InstCast *Inst); | 84 virtual void lowerCast(const InstCast *Inst); |
| 85 virtual void lowerExtractElement(const InstExtractElement *Inst); |
85 virtual void lowerFcmp(const InstFcmp *Inst); | 86 virtual void lowerFcmp(const InstFcmp *Inst); |
86 virtual void lowerIcmp(const InstIcmp *Inst); | 87 virtual void lowerIcmp(const InstIcmp *Inst); |
87 virtual void lowerIntrinsicCall(const InstIntrinsicCall *Inst); | 88 virtual void lowerIntrinsicCall(const InstIntrinsicCall *Inst); |
| 89 virtual void lowerInsertElement(const InstInsertElement *Inst); |
88 virtual void lowerLoad(const InstLoad *Inst); | 90 virtual void lowerLoad(const InstLoad *Inst); |
89 virtual void lowerPhi(const InstPhi *Inst); | 91 virtual void lowerPhi(const InstPhi *Inst); |
90 virtual void lowerRet(const InstRet *Inst); | 92 virtual void lowerRet(const InstRet *Inst); |
91 virtual void lowerSelect(const InstSelect *Inst); | 93 virtual void lowerSelect(const InstSelect *Inst); |
92 virtual void lowerStore(const InstStore *Inst); | 94 virtual void lowerStore(const InstStore *Inst); |
93 virtual void lowerSwitch(const InstSwitch *Inst); | 95 virtual void lowerSwitch(const InstSwitch *Inst); |
94 virtual void lowerUnreachable(const InstUnreachable *Inst); | 96 virtual void lowerUnreachable(const InstUnreachable *Inst); |
95 virtual void doAddressOptLoad(); | 97 virtual void doAddressOptLoad(); |
96 virtual void doAddressOptStore(); | 98 virtual void doAddressOptStore(); |
97 | 99 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 return Call; | 147 return Call; |
146 } | 148 } |
147 static Type stackSlotType(); | 149 static Type stackSlotType(); |
148 | 150 |
149 Variable *copyToReg(Operand *Src, int32_t RegNum = Variable::NoRegister); | 151 Variable *copyToReg(Operand *Src, int32_t RegNum = Variable::NoRegister); |
150 | 152 |
151 // Returns a vector in a register with the given constant entries. | 153 // Returns a vector in a register with the given constant entries. |
152 Variable *makeVectorOfZeros(Type Ty, int32_t RegNum = Variable::NoRegister); | 154 Variable *makeVectorOfZeros(Type Ty, int32_t RegNum = Variable::NoRegister); |
153 Variable *makeVectorOfOnes(Type Ty, int32_t RegNum = Variable::NoRegister); | 155 Variable *makeVectorOfOnes(Type Ty, int32_t RegNum = Variable::NoRegister); |
154 | 156 |
| 157 // Return a memory operand corresponding to a stack allocated Variable. |
| 158 OperandX8632Mem *getMemoryOperandForStackSlot(Type Ty, Variable *Slot, |
| 159 uint32_t Offset = 0); |
| 160 |
155 // The following are helpers that insert lowered x86 instructions | 161 // The following are helpers that insert lowered x86 instructions |
156 // with minimal syntactic overhead, so that the lowering code can | 162 // with minimal syntactic overhead, so that the lowering code can |
157 // look as close to assembly as practical. | 163 // look as close to assembly as practical. |
158 void _adc(Variable *Dest, Operand *Src0) { | 164 void _adc(Variable *Dest, Operand *Src0) { |
159 Context.insert(InstX8632Adc::create(Func, Dest, Src0)); | 165 Context.insert(InstX8632Adc::create(Func, Dest, Src0)); |
160 } | 166 } |
161 void _add(Variable *Dest, Operand *Src0) { | 167 void _add(Variable *Dest, Operand *Src0) { |
162 Context.insert(InstX8632Add::create(Func, Dest, Src0)); | 168 Context.insert(InstX8632Add::create(Func, Dest, Src0)); |
163 } | 169 } |
164 void _addps(Variable *Dest, Operand *Src0) { | 170 void _addps(Variable *Dest, Operand *Src0) { |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 void _fld(Operand *Src0) { Context.insert(InstX8632Fld::create(Func, Src0)); } | 236 void _fld(Operand *Src0) { Context.insert(InstX8632Fld::create(Func, Src0)); } |
231 void _fstp(Variable *Dest) { | 237 void _fstp(Variable *Dest) { |
232 Context.insert(InstX8632Fstp::create(Func, Dest)); | 238 Context.insert(InstX8632Fstp::create(Func, Dest)); |
233 } | 239 } |
234 void _idiv(Variable *Dest, Operand *Src0, Operand *Src1) { | 240 void _idiv(Variable *Dest, Operand *Src0, Operand *Src1) { |
235 Context.insert(InstX8632Idiv::create(Func, Dest, Src0, Src1)); | 241 Context.insert(InstX8632Idiv::create(Func, Dest, Src0, Src1)); |
236 } | 242 } |
237 void _imul(Variable *Dest, Operand *Src0) { | 243 void _imul(Variable *Dest, Operand *Src0) { |
238 Context.insert(InstX8632Imul::create(Func, Dest, Src0)); | 244 Context.insert(InstX8632Imul::create(Func, Dest, Src0)); |
239 } | 245 } |
| 246 void _lea(Variable *Dest, Operand *Src0) { |
| 247 Context.insert(InstX8632Lea::create(Func, Dest, Src0)); |
| 248 } |
240 void _mfence() { Context.insert(InstX8632Mfence::create(Func)); } | 249 void _mfence() { Context.insert(InstX8632Mfence::create(Func)); } |
241 // If Dest=NULL is passed in, then a new variable is created, marked | 250 // If Dest=NULL is passed in, then a new variable is created, marked |
242 // as infinite register allocation weight, and returned through the | 251 // as infinite register allocation weight, and returned through the |
243 // in/out Dest argument. | 252 // in/out Dest argument. |
244 void _mov(Variable *&Dest, Operand *Src0, | 253 void _mov(Variable *&Dest, Operand *Src0, |
245 int32_t RegNum = Variable::NoRegister) { | 254 int32_t RegNum = Variable::NoRegister) { |
246 if (Dest == NULL) { | 255 if (Dest == NULL) { |
247 Dest = legalizeToVar(Src0, false, RegNum); | 256 Dest = legalizeToVar(Src0, false, RegNum); |
248 } else { | 257 } else { |
249 Context.insert(InstX8632Mov::create(Func, Dest, Src0)); | 258 Context.insert(InstX8632Mov::create(Func, Dest, Src0)); |
250 } | 259 } |
251 } | 260 } |
| 261 void _movd(Variable *Dest, Operand *Src0) { |
| 262 Context.insert(InstX8632Movd::create(Func, Dest, Src0)); |
| 263 } |
252 void _movp(Variable *Dest, Operand *Src0) { | 264 void _movp(Variable *Dest, Operand *Src0) { |
253 Context.insert(InstX8632Movp::create(Func, Dest, Src0)); | 265 Context.insert(InstX8632Movp::create(Func, Dest, Src0)); |
254 } | 266 } |
255 void _movq(Variable *Dest, Operand *Src0) { | 267 void _movq(Variable *Dest, Operand *Src0) { |
256 Context.insert(InstX8632Movq::create(Func, Dest, Src0)); | 268 Context.insert(InstX8632Movq::create(Func, Dest, Src0)); |
257 } | 269 } |
| 270 void _movss(Variable *Dest, Operand *Src0) { |
| 271 Context.insert(InstX8632Movss::create(Func, Dest, Src0)); |
| 272 } |
258 void _movsx(Variable *Dest, Operand *Src0) { | 273 void _movsx(Variable *Dest, Operand *Src0) { |
259 Context.insert(InstX8632Movsx::create(Func, Dest, Src0)); | 274 Context.insert(InstX8632Movsx::create(Func, Dest, Src0)); |
260 } | 275 } |
261 void _movzx(Variable *Dest, Operand *Src0) { | 276 void _movzx(Variable *Dest, Operand *Src0) { |
262 Context.insert(InstX8632Movzx::create(Func, Dest, Src0)); | 277 Context.insert(InstX8632Movzx::create(Func, Dest, Src0)); |
263 } | 278 } |
264 void _mul(Variable *Dest, Variable *Src0, Operand *Src1) { | 279 void _mul(Variable *Dest, Variable *Src0, Operand *Src1) { |
265 Context.insert(InstX8632Mul::create(Func, Dest, Src0, Src1)); | 280 Context.insert(InstX8632Mul::create(Func, Dest, Src0, Src1)); |
266 } | 281 } |
267 void _mulps(Variable *Dest, Operand *Src0) { | 282 void _mulps(Variable *Dest, Operand *Src0) { |
(...skipping 13 matching lines...) Expand all Loading... |
281 } | 296 } |
282 void _pand(Variable *Dest, Operand *Src0) { | 297 void _pand(Variable *Dest, Operand *Src0) { |
283 Context.insert(InstX8632Pand::create(Func, Dest, Src0)); | 298 Context.insert(InstX8632Pand::create(Func, Dest, Src0)); |
284 } | 299 } |
285 void _pcmpeq(Variable *Dest, Operand *Src0) { | 300 void _pcmpeq(Variable *Dest, Operand *Src0) { |
286 Context.insert(InstX8632Pcmpeq::create(Func, Dest, Src0)); | 301 Context.insert(InstX8632Pcmpeq::create(Func, Dest, Src0)); |
287 } | 302 } |
288 void _pcmpgt(Variable *Dest, Operand *Src0) { | 303 void _pcmpgt(Variable *Dest, Operand *Src0) { |
289 Context.insert(InstX8632Pcmpgt::create(Func, Dest, Src0)); | 304 Context.insert(InstX8632Pcmpgt::create(Func, Dest, Src0)); |
290 } | 305 } |
| 306 void _pextrw(Variable *Dest, Operand *Src0, Operand *Src1) { |
| 307 Context.insert(InstX8632Pextrw::create(Func, Dest, Src0, Src1)); |
| 308 } |
| 309 void _pinsrw(Variable *Dest, Operand *Src0, Operand *Src1) { |
| 310 Context.insert(InstX8632Pinsrw::create(Func, Dest, Src0, Src1)); |
| 311 } |
291 void _pmullw(Variable *Dest, Operand *Src0) { | 312 void _pmullw(Variable *Dest, Operand *Src0) { |
292 Context.insert(InstX8632Pmullw::create(Func, Dest, Src0)); | 313 Context.insert(InstX8632Pmullw::create(Func, Dest, Src0)); |
293 } | 314 } |
294 void _pmuludq(Variable *Dest, Operand *Src0) { | 315 void _pmuludq(Variable *Dest, Operand *Src0) { |
295 Context.insert(InstX8632Pmuludq::create(Func, Dest, Src0)); | 316 Context.insert(InstX8632Pmuludq::create(Func, Dest, Src0)); |
296 } | 317 } |
297 void _pop(Variable *Dest) { | 318 void _pop(Variable *Dest) { |
298 Context.insert(InstX8632Pop::create(Func, Dest)); | 319 Context.insert(InstX8632Pop::create(Func, Dest)); |
299 } | 320 } |
300 void _por(Variable *Dest, Operand *Src0) { | 321 void _por(Variable *Dest, Operand *Src0) { |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 virtual ~TargetGlobalInitX8632() {} | 442 virtual ~TargetGlobalInitX8632() {} |
422 }; | 443 }; |
423 | 444 |
424 template <> void ConstantInteger::emit(GlobalContext *Ctx) const; | 445 template <> void ConstantInteger::emit(GlobalContext *Ctx) const; |
425 template <> void ConstantFloat::emit(GlobalContext *Ctx) const; | 446 template <> void ConstantFloat::emit(GlobalContext *Ctx) const; |
426 template <> void ConstantDouble::emit(GlobalContext *Ctx) const; | 447 template <> void ConstantDouble::emit(GlobalContext *Ctx) const; |
427 | 448 |
428 } // end of namespace Ice | 449 } // end of namespace Ice |
429 | 450 |
430 #endif // SUBZERO_SRC_ICETARGETLOWERINGX8632_H | 451 #endif // SUBZERO_SRC_ICETARGETLOWERINGX8632_H |
OLD | NEW |