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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 void lowerIcmp(const InstIcmp *Inst) override; | 173 void lowerIcmp(const InstIcmp *Inst) override; |
174 void lowerIntrinsicCall(const InstIntrinsicCall *Inst) override; | 174 void lowerIntrinsicCall(const InstIntrinsicCall *Inst) override; |
175 void lowerInsertElement(const InstInsertElement *Inst) override; | 175 void lowerInsertElement(const InstInsertElement *Inst) override; |
176 void lowerLoad(const InstLoad *Inst) override; | 176 void lowerLoad(const InstLoad *Inst) override; |
177 void lowerPhi(const InstPhi *Inst) override; | 177 void lowerPhi(const InstPhi *Inst) override; |
178 void lowerRet(const InstRet *Inst) override; | 178 void lowerRet(const InstRet *Inst) override; |
179 void lowerSelect(const InstSelect *Inst) override; | 179 void lowerSelect(const InstSelect *Inst) override; |
180 void lowerStore(const InstStore *Inst) override; | 180 void lowerStore(const InstStore *Inst) override; |
181 void lowerSwitch(const InstSwitch *Inst) override; | 181 void lowerSwitch(const InstSwitch *Inst) override; |
182 void lowerUnreachable(const InstUnreachable *Inst) override; | 182 void lowerUnreachable(const InstUnreachable *Inst) override; |
| 183 void lowerOther(const Inst *Instr) override; |
| 184 void lowerRMW(const InstX8632FakeRMW *RMW); |
183 void prelowerPhis() override; | 185 void prelowerPhis() override; |
184 void lowerPhiAssignments(CfgNode *Node, | 186 void lowerPhiAssignments(CfgNode *Node, |
185 const AssignList &Assignments) override; | 187 const AssignList &Assignments) override; |
186 void doAddressOptLoad() override; | 188 void doAddressOptLoad() override; |
187 void doAddressOptStore() override; | 189 void doAddressOptStore() override; |
188 void randomlyInsertNop(float Probability) override; | 190 void randomlyInsertNop(float Probability) override; |
189 | 191 |
190 // Naive lowering of cmpxchg. | 192 // Naive lowering of cmpxchg. |
191 void lowerAtomicCmpxchg(Variable *DestPrev, Operand *Ptr, Operand *Expected, | 193 void lowerAtomicCmpxchg(Variable *DestPrev, Operand *Ptr, Operand *Expected, |
192 Operand *Desired); | 194 Operand *Desired); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 | 260 |
259 // The following are helpers that insert lowered x86 instructions | 261 // The following are helpers that insert lowered x86 instructions |
260 // with minimal syntactic overhead, so that the lowering code can | 262 // with minimal syntactic overhead, so that the lowering code can |
261 // look as close to assembly as practical. | 263 // look as close to assembly as practical. |
262 void _adc(Variable *Dest, Operand *Src0) { | 264 void _adc(Variable *Dest, Operand *Src0) { |
263 Context.insert(InstX8632Adc::create(Func, Dest, Src0)); | 265 Context.insert(InstX8632Adc::create(Func, Dest, Src0)); |
264 } | 266 } |
265 void _add(Variable *Dest, Operand *Src0) { | 267 void _add(Variable *Dest, Operand *Src0) { |
266 Context.insert(InstX8632Add::create(Func, Dest, Src0)); | 268 Context.insert(InstX8632Add::create(Func, Dest, Src0)); |
267 } | 269 } |
| 270 void _add_rmw(Operand *DestSrc0, Operand *Src1) { |
| 271 Context.insert(InstX8632AddRMW::create(Func, DestSrc0, Src1)); |
| 272 } |
268 void _adjust_stack(int32_t Amount) { | 273 void _adjust_stack(int32_t Amount) { |
269 Context.insert(InstX8632AdjustStack::create( | 274 Context.insert(InstX8632AdjustStack::create( |
270 Func, Amount, getPhysicalRegister(RegX8632::Reg_esp))); | 275 Func, Amount, getPhysicalRegister(RegX8632::Reg_esp))); |
271 } | 276 } |
272 void _addps(Variable *Dest, Operand *Src0) { | 277 void _addps(Variable *Dest, Operand *Src0) { |
273 Context.insert(InstX8632Addps::create(Func, Dest, Src0)); | 278 Context.insert(InstX8632Addps::create(Func, Dest, Src0)); |
274 } | 279 } |
275 void _addss(Variable *Dest, Operand *Src0) { | 280 void _addss(Variable *Dest, Operand *Src0) { |
276 Context.insert(InstX8632Addss::create(Func, Dest, Src0)); | 281 Context.insert(InstX8632Addss::create(Func, Dest, Src0)); |
277 } | 282 } |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 Context.insert(InstFakeUse::create(Func, Src)); | 559 Context.insert(InstFakeUse::create(Func, Src)); |
555 } | 560 } |
556 void _xor(Variable *Dest, Operand *Src0) { | 561 void _xor(Variable *Dest, Operand *Src0) { |
557 Context.insert(InstX8632Xor::create(Func, Dest, Src0)); | 562 Context.insert(InstX8632Xor::create(Func, Dest, Src0)); |
558 } | 563 } |
559 void _set_dest_nonkillable() { | 564 void _set_dest_nonkillable() { |
560 Context.getLastInserted()->setDestNonKillable(); | 565 Context.getLastInserted()->setDestNonKillable(); |
561 } | 566 } |
562 | 567 |
563 bool optimizeScalarMul(Variable *Dest, Operand *Src0, int32_t Src1); | 568 bool optimizeScalarMul(Variable *Dest, Operand *Src0, int32_t Src1); |
| 569 void findRMW(); |
564 | 570 |
565 X86InstructionSet InstructionSet; | 571 X86InstructionSet InstructionSet; |
566 bool IsEbpBasedFrame; | 572 bool IsEbpBasedFrame; |
567 bool NeedsStackAlignment; | 573 bool NeedsStackAlignment; |
568 size_t SpillAreaSizeBytes; | 574 size_t SpillAreaSizeBytes; |
569 llvm::SmallBitVector TypeToRegisterSet[IceType_NUM]; | 575 llvm::SmallBitVector TypeToRegisterSet[IceType_NUM]; |
570 llvm::SmallBitVector ScratchRegs; | 576 llvm::SmallBitVector ScratchRegs; |
571 llvm::SmallBitVector RegsUsed; | 577 llvm::SmallBitVector RegsUsed; |
572 VarList PhysicalRegisters[IceType_NUM]; | 578 VarList PhysicalRegisters[IceType_NUM]; |
573 static IceString RegNames[]; | 579 static IceString RegNames[]; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
611 protected: | 617 protected: |
612 explicit TargetHeaderX8632(GlobalContext *Ctx); | 618 explicit TargetHeaderX8632(GlobalContext *Ctx); |
613 | 619 |
614 private: | 620 private: |
615 ~TargetHeaderX8632() = default; | 621 ~TargetHeaderX8632() = default; |
616 }; | 622 }; |
617 | 623 |
618 } // end of namespace Ice | 624 } // end of namespace Ice |
619 | 625 |
620 #endif // SUBZERO_SRC_ICETARGETLOWERINGX8632_H | 626 #endif // SUBZERO_SRC_ICETARGETLOWERINGX8632_H |
OLD | NEW |