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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 virtual void lowerStore(const InstStore *Inst); | 92 virtual void lowerStore(const InstStore *Inst); |
93 virtual void lowerSwitch(const InstSwitch *Inst); | 93 virtual void lowerSwitch(const InstSwitch *Inst); |
94 virtual void lowerUnreachable(const InstUnreachable *Inst); | 94 virtual void lowerUnreachable(const InstUnreachable *Inst); |
95 virtual void doAddressOptLoad(); | 95 virtual void doAddressOptLoad(); |
96 virtual void doAddressOptStore(); | 96 virtual void doAddressOptStore(); |
97 | 97 |
98 void lowerAtomicCmpxchg(Variable *DestPrev, Operand *Ptr, Operand *Expected, | 98 void lowerAtomicCmpxchg(Variable *DestPrev, Operand *Ptr, Operand *Expected, |
99 Operand *Desired); | 99 Operand *Desired); |
100 void lowerAtomicRMW(Variable *Dest, uint32_t Operation, Operand *Ptr, | 100 void lowerAtomicRMW(Variable *Dest, uint32_t Operation, Operand *Ptr, |
101 Operand *Val); | 101 Operand *Val); |
| 102 void lowerCountZeros(bool Cttz, Type Ty, Variable *Dest, Operand *FirstVal, |
| 103 Operand *SecondVal); |
102 | 104 |
103 typedef void (TargetX8632::*LowerBinOp)(Variable *, Operand *); | 105 typedef void (TargetX8632::*LowerBinOp)(Variable *, Operand *); |
104 void expandAtomicRMWAsCmpxchg(LowerBinOp op_lo, LowerBinOp op_hi, | 106 void expandAtomicRMWAsCmpxchg(LowerBinOp op_lo, LowerBinOp op_hi, |
105 Variable *Dest, Operand *Ptr, Operand *Val); | 107 Variable *Dest, Operand *Ptr, Operand *Val); |
106 | 108 |
107 // Operand legalization helpers. To deal with address mode | 109 // Operand legalization helpers. To deal with address mode |
108 // constraints, the helpers will create a new Operand and emit | 110 // constraints, the helpers will create a new Operand and emit |
109 // instructions that guarantee that the Operand kind is one of those | 111 // instructions that guarantee that the Operand kind is one of those |
110 // indicated by the LegalMask (a bitmask of allowed kinds). If the | 112 // indicated by the LegalMask (a bitmask of allowed kinds). If the |
111 // input Operand is known to already meet the constraints, it may be | 113 // input Operand is known to already meet the constraints, it may be |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 } | 159 } |
158 void _addps(Variable *Dest, Operand *Src0) { | 160 void _addps(Variable *Dest, Operand *Src0) { |
159 Context.insert(InstX8632Addps::create(Func, Dest, Src0)); | 161 Context.insert(InstX8632Addps::create(Func, Dest, Src0)); |
160 } | 162 } |
161 void _addss(Variable *Dest, Operand *Src0) { | 163 void _addss(Variable *Dest, Operand *Src0) { |
162 Context.insert(InstX8632Addss::create(Func, Dest, Src0)); | 164 Context.insert(InstX8632Addss::create(Func, Dest, Src0)); |
163 } | 165 } |
164 void _and(Variable *Dest, Operand *Src0) { | 166 void _and(Variable *Dest, Operand *Src0) { |
165 Context.insert(InstX8632And::create(Func, Dest, Src0)); | 167 Context.insert(InstX8632And::create(Func, Dest, Src0)); |
166 } | 168 } |
167 void _br(InstX8632Br::BrCond Condition, CfgNode *TargetTrue, | 169 void _br(InstX8632::BrCond Condition, CfgNode *TargetTrue, |
168 CfgNode *TargetFalse) { | 170 CfgNode *TargetFalse) { |
169 Context.insert( | 171 Context.insert( |
170 InstX8632Br::create(Func, TargetTrue, TargetFalse, Condition)); | 172 InstX8632Br::create(Func, TargetTrue, TargetFalse, Condition)); |
171 } | 173 } |
172 void _br(CfgNode *Target) { | 174 void _br(CfgNode *Target) { |
173 Context.insert(InstX8632Br::create(Func, Target)); | 175 Context.insert(InstX8632Br::create(Func, Target)); |
174 } | 176 } |
175 void _br(InstX8632Br::BrCond Condition, CfgNode *Target) { | 177 void _br(InstX8632::BrCond Condition, CfgNode *Target) { |
176 Context.insert(InstX8632Br::create(Func, Target, Condition)); | 178 Context.insert(InstX8632Br::create(Func, Target, Condition)); |
177 } | 179 } |
178 void _br(InstX8632Br::BrCond Condition, InstX8632Label *Label) { | 180 void _br(InstX8632::BrCond Condition, InstX8632Label *Label) { |
179 Context.insert(InstX8632Br::create(Func, Label, Condition)); | 181 Context.insert(InstX8632Br::create(Func, Label, Condition)); |
180 } | 182 } |
| 183 void _bsf(Variable *Dest, Operand *Src0) { |
| 184 Context.insert(InstX8632Bsf::create(Func, Dest, Src0)); |
| 185 } |
| 186 void _bsr(Variable *Dest, Operand *Src0) { |
| 187 Context.insert(InstX8632Bsr::create(Func, Dest, Src0)); |
| 188 } |
181 void _cdq(Variable *Dest, Operand *Src0) { | 189 void _cdq(Variable *Dest, Operand *Src0) { |
182 Context.insert(InstX8632Cdq::create(Func, Dest, Src0)); | 190 Context.insert(InstX8632Cdq::create(Func, Dest, Src0)); |
183 } | 191 } |
| 192 void _cmov(Variable *Dest, Operand *Src0, InstX8632::BrCond Condition) { |
| 193 Context.insert(InstX8632Cmov::create(Func, Dest, Src0, Condition)); |
| 194 } |
184 void _cmp(Operand *Src0, Operand *Src1) { | 195 void _cmp(Operand *Src0, Operand *Src1) { |
185 Context.insert(InstX8632Icmp::create(Func, Src0, Src1)); | 196 Context.insert(InstX8632Icmp::create(Func, Src0, Src1)); |
186 } | 197 } |
187 void _cmpxchg(Operand *DestOrAddr, Variable *Eax, Variable *Desired, | 198 void _cmpxchg(Operand *DestOrAddr, Variable *Eax, Variable *Desired, |
188 bool Locked) { | 199 bool Locked) { |
189 Context.insert( | 200 Context.insert( |
190 InstX8632Cmpxchg::create(Func, DestOrAddr, Eax, Desired, Locked)); | 201 InstX8632Cmpxchg::create(Func, DestOrAddr, Eax, Desired, Locked)); |
191 // Mark eax as possibly modified by cmpxchg. | 202 // Mark eax as possibly modified by cmpxchg. |
192 Context.insert( | 203 Context.insert( |
193 InstFakeDef::create(Func, Eax, llvm::dyn_cast<Variable>(DestOrAddr))); | 204 InstFakeDef::create(Func, Eax, llvm::dyn_cast<Variable>(DestOrAddr))); |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 virtual ~TargetGlobalInitX8632() {} | 381 virtual ~TargetGlobalInitX8632() {} |
371 }; | 382 }; |
372 | 383 |
373 template <> void ConstantInteger::emit(GlobalContext *Ctx) const; | 384 template <> void ConstantInteger::emit(GlobalContext *Ctx) const; |
374 template <> void ConstantFloat::emit(GlobalContext *Ctx) const; | 385 template <> void ConstantFloat::emit(GlobalContext *Ctx) const; |
375 template <> void ConstantDouble::emit(GlobalContext *Ctx) const; | 386 template <> void ConstantDouble::emit(GlobalContext *Ctx) const; |
376 | 387 |
377 } // end of namespace Ice | 388 } // end of namespace Ice |
378 | 389 |
379 #endif // SUBZERO_SRC_ICETARGETLOWERINGX8632_H | 390 #endif // SUBZERO_SRC_ICETARGETLOWERINGX8632_H |
OLD | NEW |