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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 | 141 |
142 // The following are helpers that insert lowered x86 instructions | 142 // The following are helpers that insert lowered x86 instructions |
143 // with minimal syntactic overhead, so that the lowering code can | 143 // with minimal syntactic overhead, so that the lowering code can |
144 // look as close to assembly as practical. | 144 // look as close to assembly as practical. |
145 void _adc(Variable *Dest, Operand *Src0) { | 145 void _adc(Variable *Dest, Operand *Src0) { |
146 Context.insert(InstX8632Adc::create(Func, Dest, Src0)); | 146 Context.insert(InstX8632Adc::create(Func, Dest, Src0)); |
147 } | 147 } |
148 void _add(Variable *Dest, Operand *Src0) { | 148 void _add(Variable *Dest, Operand *Src0) { |
149 Context.insert(InstX8632Add::create(Func, Dest, Src0)); | 149 Context.insert(InstX8632Add::create(Func, Dest, Src0)); |
150 } | 150 } |
| 151 void _addps(Variable *Dest, Operand *Src0) { |
| 152 Context.insert(InstX8632Addps::create(Func, Dest, Src0)); |
| 153 } |
151 void _addss(Variable *Dest, Operand *Src0) { | 154 void _addss(Variable *Dest, Operand *Src0) { |
152 Context.insert(InstX8632Addss::create(Func, Dest, Src0)); | 155 Context.insert(InstX8632Addss::create(Func, Dest, Src0)); |
153 } | 156 } |
154 void _and(Variable *Dest, Operand *Src0) { | 157 void _and(Variable *Dest, Operand *Src0) { |
155 Context.insert(InstX8632And::create(Func, Dest, Src0)); | 158 Context.insert(InstX8632And::create(Func, Dest, Src0)); |
156 } | 159 } |
157 void _br(InstX8632Br::BrCond Condition, CfgNode *TargetTrue, | 160 void _br(InstX8632Br::BrCond Condition, CfgNode *TargetTrue, |
158 CfgNode *TargetFalse) { | 161 CfgNode *TargetFalse) { |
159 Context.insert( | 162 Context.insert( |
160 InstX8632Br::create(Func, TargetTrue, TargetFalse, Condition)); | 163 InstX8632Br::create(Func, TargetTrue, TargetFalse, Condition)); |
(...skipping 12 matching lines...) Expand all Loading... |
173 } | 176 } |
174 void _cmp(Operand *Src0, Operand *Src1) { | 177 void _cmp(Operand *Src0, Operand *Src1) { |
175 Context.insert(InstX8632Icmp::create(Func, Src0, Src1)); | 178 Context.insert(InstX8632Icmp::create(Func, Src0, Src1)); |
176 } | 179 } |
177 void _cvt(Variable *Dest, Operand *Src0) { | 180 void _cvt(Variable *Dest, Operand *Src0) { |
178 Context.insert(InstX8632Cvt::create(Func, Dest, Src0)); | 181 Context.insert(InstX8632Cvt::create(Func, Dest, Src0)); |
179 } | 182 } |
180 void _div(Variable *Dest, Operand *Src0, Operand *Src1) { | 183 void _div(Variable *Dest, Operand *Src0, Operand *Src1) { |
181 Context.insert(InstX8632Div::create(Func, Dest, Src0, Src1)); | 184 Context.insert(InstX8632Div::create(Func, Dest, Src0, Src1)); |
182 } | 185 } |
| 186 void _divps(Variable *Dest, Operand *Src0) { |
| 187 Context.insert(InstX8632Divps::create(Func, Dest, Src0)); |
| 188 } |
183 void _divss(Variable *Dest, Operand *Src0) { | 189 void _divss(Variable *Dest, Operand *Src0) { |
184 Context.insert(InstX8632Divss::create(Func, Dest, Src0)); | 190 Context.insert(InstX8632Divss::create(Func, Dest, Src0)); |
185 } | 191 } |
186 void _fld(Operand *Src0) { Context.insert(InstX8632Fld::create(Func, Src0)); } | 192 void _fld(Operand *Src0) { Context.insert(InstX8632Fld::create(Func, Src0)); } |
187 void _fstp(Variable *Dest) { | 193 void _fstp(Variable *Dest) { |
188 Context.insert(InstX8632Fstp::create(Func, Dest)); | 194 Context.insert(InstX8632Fstp::create(Func, Dest)); |
189 } | 195 } |
190 void _idiv(Variable *Dest, Operand *Src0, Operand *Src1) { | 196 void _idiv(Variable *Dest, Operand *Src0, Operand *Src1) { |
191 Context.insert(InstX8632Idiv::create(Func, Dest, Src0, Src1)); | 197 Context.insert(InstX8632Idiv::create(Func, Dest, Src0, Src1)); |
192 } | 198 } |
(...skipping 20 matching lines...) Expand all Loading... |
213 } | 219 } |
214 void _movsx(Variable *Dest, Operand *Src0) { | 220 void _movsx(Variable *Dest, Operand *Src0) { |
215 Context.insert(InstX8632Movsx::create(Func, Dest, Src0)); | 221 Context.insert(InstX8632Movsx::create(Func, Dest, Src0)); |
216 } | 222 } |
217 void _movzx(Variable *Dest, Operand *Src0) { | 223 void _movzx(Variable *Dest, Operand *Src0) { |
218 Context.insert(InstX8632Movzx::create(Func, Dest, Src0)); | 224 Context.insert(InstX8632Movzx::create(Func, Dest, Src0)); |
219 } | 225 } |
220 void _mul(Variable *Dest, Variable *Src0, Operand *Src1) { | 226 void _mul(Variable *Dest, Variable *Src0, Operand *Src1) { |
221 Context.insert(InstX8632Mul::create(Func, Dest, Src0, Src1)); | 227 Context.insert(InstX8632Mul::create(Func, Dest, Src0, Src1)); |
222 } | 228 } |
| 229 void _mulps(Variable *Dest, Operand *Src0) { |
| 230 Context.insert(InstX8632Mulps::create(Func, Dest, Src0)); |
| 231 } |
223 void _mulss(Variable *Dest, Operand *Src0) { | 232 void _mulss(Variable *Dest, Operand *Src0) { |
224 Context.insert(InstX8632Mulss::create(Func, Dest, Src0)); | 233 Context.insert(InstX8632Mulss::create(Func, Dest, Src0)); |
225 } | 234 } |
226 void _or(Variable *Dest, Operand *Src0) { | 235 void _or(Variable *Dest, Operand *Src0) { |
227 Context.insert(InstX8632Or::create(Func, Dest, Src0)); | 236 Context.insert(InstX8632Or::create(Func, Dest, Src0)); |
228 } | 237 } |
229 void _pop(Variable *Dest) { | 238 void _pop(Variable *Dest) { |
230 Context.insert(InstX8632Pop::create(Func, Dest)); | 239 Context.insert(InstX8632Pop::create(Func, Dest)); |
231 } | 240 } |
232 void _push(Operand *Src0, bool SuppressStackAdjustment = false) { | 241 void _push(Operand *Src0, bool SuppressStackAdjustment = false) { |
233 Context.insert(InstX8632Push::create(Func, Src0, SuppressStackAdjustment)); | 242 Context.insert(InstX8632Push::create(Func, Src0, SuppressStackAdjustment)); |
234 } | 243 } |
| 244 void _pxor(Variable *Dest, Operand *Src0) { |
| 245 Context.insert(InstX8632Pxor::create(Func, Dest, Src0)); |
| 246 } |
235 void _ret(Variable *Src0 = NULL) { | 247 void _ret(Variable *Src0 = NULL) { |
236 Context.insert(InstX8632Ret::create(Func, Src0)); | 248 Context.insert(InstX8632Ret::create(Func, Src0)); |
237 } | 249 } |
238 void _sar(Variable *Dest, Operand *Src0) { | 250 void _sar(Variable *Dest, Operand *Src0) { |
239 Context.insert(InstX8632Sar::create(Func, Dest, Src0)); | 251 Context.insert(InstX8632Sar::create(Func, Dest, Src0)); |
240 } | 252 } |
241 void _sbb(Variable *Dest, Operand *Src0) { | 253 void _sbb(Variable *Dest, Operand *Src0) { |
242 Context.insert(InstX8632Sbb::create(Func, Dest, Src0)); | 254 Context.insert(InstX8632Sbb::create(Func, Dest, Src0)); |
243 } | 255 } |
244 void _shl(Variable *Dest, Operand *Src0) { | 256 void _shl(Variable *Dest, Operand *Src0) { |
(...skipping 13 matching lines...) Expand all Loading... |
258 } | 270 } |
259 void _store(Operand *Value, OperandX8632 *Mem) { | 271 void _store(Operand *Value, OperandX8632 *Mem) { |
260 Context.insert(InstX8632Store::create(Func, Value, Mem)); | 272 Context.insert(InstX8632Store::create(Func, Value, Mem)); |
261 } | 273 } |
262 void _storeq(Operand *Value, OperandX8632 *Mem) { | 274 void _storeq(Operand *Value, OperandX8632 *Mem) { |
263 Context.insert(InstX8632StoreQ::create(Func, Value, Mem)); | 275 Context.insert(InstX8632StoreQ::create(Func, Value, Mem)); |
264 } | 276 } |
265 void _sub(Variable *Dest, Operand *Src0) { | 277 void _sub(Variable *Dest, Operand *Src0) { |
266 Context.insert(InstX8632Sub::create(Func, Dest, Src0)); | 278 Context.insert(InstX8632Sub::create(Func, Dest, Src0)); |
267 } | 279 } |
| 280 void _subps(Variable *Dest, Operand *Src0) { |
| 281 Context.insert(InstX8632Subps::create(Func, Dest, Src0)); |
| 282 } |
268 void _subss(Variable *Dest, Operand *Src0) { | 283 void _subss(Variable *Dest, Operand *Src0) { |
269 Context.insert(InstX8632Subss::create(Func, Dest, Src0)); | 284 Context.insert(InstX8632Subss::create(Func, Dest, Src0)); |
270 } | 285 } |
271 void _test(Operand *Src0, Operand *Src1) { | 286 void _test(Operand *Src0, Operand *Src1) { |
272 Context.insert(InstX8632Test::create(Func, Src0, Src1)); | 287 Context.insert(InstX8632Test::create(Func, Src0, Src1)); |
273 } | 288 } |
274 void _ucomiss(Operand *Src0, Operand *Src1) { | 289 void _ucomiss(Operand *Src0, Operand *Src1) { |
275 Context.insert(InstX8632Ucomiss::create(Func, Src0, Src1)); | 290 Context.insert(InstX8632Ucomiss::create(Func, Src0, Src1)); |
276 } | 291 } |
277 void _ud2() { Context.insert(InstX8632UD2::create(Func)); } | 292 void _ud2() { Context.insert(InstX8632UD2::create(Func)); } |
278 void _xadd(Operand *Dest, Variable *Src, bool Locked) { | 293 void _xadd(Operand *Dest, Variable *Src, bool Locked) { |
279 Context.insert(InstX8632Xadd::create(Func, Dest, Src, Locked)); | 294 Context.insert(InstX8632Xadd::create(Func, Dest, Src, Locked)); |
280 // The xadd exchanges Dest and Src (modifying Src). | 295 // The xadd exchanges Dest and Src (modifying Src). |
281 // Model that update with a FakeDef. | 296 // Model that update with a FakeDef. |
282 Context.insert(InstFakeDef::create(Func, Src)); | 297 Context.insert(InstFakeDef::create(Func, Src)); |
283 } | 298 } |
284 void _xor(Variable *Dest, Operand *Src0) { | 299 void _xor(Variable *Dest, Operand *Src0) { |
285 Context.insert(InstX8632Xor::create(Func, Dest, Src0)); | 300 Context.insert(InstX8632Xor::create(Func, Dest, Src0)); |
286 } | 301 } |
287 void _pxor(Variable *Dest, Operand *Src0) { | |
288 Context.insert(InstX8632Pxor::create(Func, Dest, Src0)); | |
289 } | |
290 | 302 |
291 bool IsEbpBasedFrame; | 303 bool IsEbpBasedFrame; |
292 size_t FrameSizeLocals; | 304 size_t FrameSizeLocals; |
293 size_t LocalsSizeBytes; | 305 size_t LocalsSizeBytes; |
294 llvm::SmallBitVector TypeToRegisterSet[IceType_NUM]; | 306 llvm::SmallBitVector TypeToRegisterSet[IceType_NUM]; |
295 llvm::SmallBitVector ScratchRegs; | 307 llvm::SmallBitVector ScratchRegs; |
296 llvm::SmallBitVector RegsUsed; | 308 llvm::SmallBitVector RegsUsed; |
297 SizeT NextLabelNumber; | 309 SizeT NextLabelNumber; |
298 bool ComputedLiveRanges; | 310 bool ComputedLiveRanges; |
299 VarList PhysicalRegisters; | 311 VarList PhysicalRegisters; |
(...skipping 25 matching lines...) Expand all Loading... |
325 virtual ~TargetGlobalInitX8632() {} | 337 virtual ~TargetGlobalInitX8632() {} |
326 }; | 338 }; |
327 | 339 |
328 template <> void ConstantInteger::emit(GlobalContext *Ctx) const; | 340 template <> void ConstantInteger::emit(GlobalContext *Ctx) const; |
329 template <> void ConstantFloat::emit(GlobalContext *Ctx) const; | 341 template <> void ConstantFloat::emit(GlobalContext *Ctx) const; |
330 template <> void ConstantDouble::emit(GlobalContext *Ctx) const; | 342 template <> void ConstantDouble::emit(GlobalContext *Ctx) const; |
331 | 343 |
332 } // end of namespace Ice | 344 } // end of namespace Ice |
333 | 345 |
334 #endif // SUBZERO_SRC_ICETARGETLOWERINGX8632_H | 346 #endif // SUBZERO_SRC_ICETARGETLOWERINGX8632_H |
OLD | NEW |