| 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 22 matching lines...) Expand all Loading... |
| 33 virtual IceString getRegName(SizeT RegNum, Type Ty) const; | 33 virtual IceString getRegName(SizeT RegNum, Type Ty) const; |
| 34 virtual llvm::SmallBitVector getRegisterSet(RegSetMask Include, | 34 virtual llvm::SmallBitVector getRegisterSet(RegSetMask Include, |
| 35 RegSetMask Exclude) const; | 35 RegSetMask Exclude) const; |
| 36 virtual const llvm::SmallBitVector &getRegisterSetForType(Type Ty) const { | 36 virtual const llvm::SmallBitVector &getRegisterSetForType(Type Ty) const { |
| 37 return TypeToRegisterSet[Ty]; | 37 return TypeToRegisterSet[Ty]; |
| 38 } | 38 } |
| 39 virtual bool hasFramePointer() const { return IsEbpBasedFrame; } | 39 virtual bool hasFramePointer() const { return IsEbpBasedFrame; } |
| 40 virtual SizeT getFrameOrStackReg() const { | 40 virtual SizeT getFrameOrStackReg() const { |
| 41 return IsEbpBasedFrame ? Reg_ebp : Reg_esp; | 41 return IsEbpBasedFrame ? Reg_ebp : Reg_esp; |
| 42 } | 42 } |
| 43 virtual size_t typeWidthInBytesOnStack(Type Ty) { | 43 virtual size_t typeWidthInBytesOnStack(Type Ty) const { |
| 44 // Round up to the next multiple of 4 bytes. In particular, i1, | 44 // Round up to the next multiple of 4 bytes. In particular, i1, |
| 45 // i8, and i16 are rounded up to 4 bytes. | 45 // i8, and i16 are rounded up to 4 bytes. |
| 46 return (typeWidthInBytes(Ty) + 3) & ~3; | 46 return (typeWidthInBytes(Ty) + 3) & ~3; |
| 47 } | 47 } |
| 48 virtual void emitVariable(const Variable *Var, const Cfg *Func) const; | 48 virtual void emitVariable(const Variable *Var, const Cfg *Func) const; |
| 49 virtual void lowerArguments(); | 49 virtual void lowerArguments(); |
| 50 virtual void addProlog(CfgNode *Node); | 50 virtual void addProlog(CfgNode *Node); |
| 51 virtual void addEpilog(CfgNode *Node); | 51 virtual void addEpilog(CfgNode *Node); |
| 52 virtual void emitConstants() const; | 52 virtual void emitConstants() const; |
| 53 SizeT makeNextLabelNumber() { return NextLabelNumber++; } | 53 SizeT makeNextLabelNumber() { return NextLabelNumber++; } |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 | 118 |
| 119 typedef void (TargetX8632::*LowerBinOp)(Variable *, Operand *); | 119 typedef void (TargetX8632::*LowerBinOp)(Variable *, Operand *); |
| 120 void expandAtomicRMWAsCmpxchg(LowerBinOp op_lo, LowerBinOp op_hi, | 120 void expandAtomicRMWAsCmpxchg(LowerBinOp op_lo, LowerBinOp op_hi, |
| 121 Variable *Dest, Operand *Ptr, Operand *Val); | 121 Variable *Dest, Operand *Ptr, Operand *Val); |
| 122 | 122 |
| 123 void eliminateNextVectorSextInstruction(Variable *SignExtendedResult); | 123 void eliminateNextVectorSextInstruction(Variable *SignExtendedResult); |
| 124 | 124 |
| 125 void scalarizeArithmetic(InstArithmetic::OpKind K, Variable *Dest, | 125 void scalarizeArithmetic(InstArithmetic::OpKind K, Variable *Dest, |
| 126 Operand *Src0, Operand *Src1); | 126 Operand *Src0, Operand *Src1); |
| 127 | 127 |
| 128 void sortByAlignment(VarList &Dest, const VarList &Source) const; |
| 129 |
| 128 // Operand legalization helpers. To deal with address mode | 130 // Operand legalization helpers. To deal with address mode |
| 129 // constraints, the helpers will create a new Operand and emit | 131 // constraints, the helpers will create a new Operand and emit |
| 130 // instructions that guarantee that the Operand kind is one of those | 132 // instructions that guarantee that the Operand kind is one of those |
| 131 // indicated by the LegalMask (a bitmask of allowed kinds). If the | 133 // indicated by the LegalMask (a bitmask of allowed kinds). If the |
| 132 // input Operand is known to already meet the constraints, it may be | 134 // input Operand is known to already meet the constraints, it may be |
| 133 // simply returned as the result, without creating any new | 135 // simply returned as the result, without creating any new |
| 134 // instructions or operands. | 136 // instructions or operands. |
| 135 enum OperandLegalization { | 137 enum OperandLegalization { |
| 136 Legal_None = 0, | 138 Legal_None = 0, |
| 137 Legal_Reg = 1 << 0, // physical register, not stack location | 139 Legal_Reg = 1 << 0, // physical register, not stack location |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 InstFakeDef::create(Func, Src, llvm::dyn_cast<Variable>(Dest))); | 453 InstFakeDef::create(Func, Src, llvm::dyn_cast<Variable>(Dest))); |
| 452 } | 454 } |
| 453 void _xor(Variable *Dest, Operand *Src0) { | 455 void _xor(Variable *Dest, Operand *Src0) { |
| 454 Context.insert(InstX8632Xor::create(Func, Dest, Src0)); | 456 Context.insert(InstX8632Xor::create(Func, Dest, Src0)); |
| 455 } | 457 } |
| 456 | 458 |
| 457 const X86InstructionSet InstructionSet; | 459 const X86InstructionSet InstructionSet; |
| 458 bool IsEbpBasedFrame; | 460 bool IsEbpBasedFrame; |
| 459 bool NeedsStackAlignment; | 461 bool NeedsStackAlignment; |
| 460 size_t FrameSizeLocals; | 462 size_t FrameSizeLocals; |
| 461 size_t LocalsSizeBytes; | 463 size_t SpillAreaSizeBytes; |
| 462 llvm::SmallBitVector TypeToRegisterSet[IceType_NUM]; | 464 llvm::SmallBitVector TypeToRegisterSet[IceType_NUM]; |
| 463 llvm::SmallBitVector ScratchRegs; | 465 llvm::SmallBitVector ScratchRegs; |
| 464 llvm::SmallBitVector RegsUsed; | 466 llvm::SmallBitVector RegsUsed; |
| 465 SizeT NextLabelNumber; | 467 SizeT NextLabelNumber; |
| 466 bool ComputedLiveRanges; | 468 bool ComputedLiveRanges; |
| 467 VarList PhysicalRegisters; | 469 VarList PhysicalRegisters; |
| 468 static IceString RegNames[]; | 470 static IceString RegNames[]; |
| 469 | 471 |
| 470 private: | 472 private: |
| 471 TargetX8632(const TargetX8632 &) LLVM_DELETED_FUNCTION; | 473 TargetX8632(const TargetX8632 &) LLVM_DELETED_FUNCTION; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 493 virtual ~TargetGlobalInitX8632() {} | 495 virtual ~TargetGlobalInitX8632() {} |
| 494 }; | 496 }; |
| 495 | 497 |
| 496 template <> void ConstantInteger::emit(GlobalContext *Ctx) const; | 498 template <> void ConstantInteger::emit(GlobalContext *Ctx) const; |
| 497 template <> void ConstantFloat::emit(GlobalContext *Ctx) const; | 499 template <> void ConstantFloat::emit(GlobalContext *Ctx) const; |
| 498 template <> void ConstantDouble::emit(GlobalContext *Ctx) const; | 500 template <> void ConstantDouble::emit(GlobalContext *Ctx) const; |
| 499 | 501 |
| 500 } // end of namespace Ice | 502 } // end of namespace Ice |
| 501 | 503 |
| 502 #endif // SUBZERO_SRC_ICETARGETLOWERINGX8632_H | 504 #endif // SUBZERO_SRC_ICETARGETLOWERINGX8632_H |
| OLD | NEW |