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 Variable *randomizeImmediate(Constant *Immediate); |
| 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 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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; |
472 TargetX8632 &operator=(const TargetX8632 &) LLVM_DELETED_FUNCTION; | 474 TargetX8632 &operator=(const TargetX8632 &) LLVM_DELETED_FUNCTION; |
473 virtual ~TargetX8632() {} | 475 virtual ~TargetX8632() {} |
474 template <typename T> void emitConstantPool() const; | 476 template <typename T> void emitConstantPool() const; |
| 477 void emitPooledImmediates() const; |
475 }; | 478 }; |
476 | 479 |
477 class TargetGlobalInitX8632 : public TargetGlobalInitLowering { | 480 class TargetGlobalInitX8632 : public TargetGlobalInitLowering { |
478 public: | 481 public: |
479 static TargetGlobalInitLowering *create(GlobalContext *Ctx) { | 482 static TargetGlobalInitLowering *create(GlobalContext *Ctx) { |
480 return new TargetGlobalInitX8632(Ctx); | 483 return new TargetGlobalInitX8632(Ctx); |
481 } | 484 } |
482 virtual void lower(const IceString &Name, SizeT Align, bool IsInternal, | 485 virtual void lower(const IceString &Name, SizeT Align, bool IsInternal, |
483 bool IsConst, bool IsZeroInitializer, SizeT Size, | 486 bool IsConst, bool IsZeroInitializer, SizeT Size, |
484 const char *Data, bool DisableTranslation); | 487 const char *Data, bool DisableTranslation); |
485 | 488 |
486 protected: | 489 protected: |
487 TargetGlobalInitX8632(GlobalContext *Ctx); | 490 TargetGlobalInitX8632(GlobalContext *Ctx); |
488 | 491 |
489 private: | 492 private: |
490 TargetGlobalInitX8632(const TargetGlobalInitX8632 &) LLVM_DELETED_FUNCTION; | 493 TargetGlobalInitX8632(const TargetGlobalInitX8632 &) LLVM_DELETED_FUNCTION; |
491 TargetGlobalInitX8632 & | 494 TargetGlobalInitX8632 & |
492 operator=(const TargetGlobalInitX8632 &) LLVM_DELETED_FUNCTION; | 495 operator=(const TargetGlobalInitX8632 &) LLVM_DELETED_FUNCTION; |
493 virtual ~TargetGlobalInitX8632() {} | 496 virtual ~TargetGlobalInitX8632() {} |
494 }; | 497 }; |
495 | 498 |
496 template <> void ConstantInteger::emit(GlobalContext *Ctx) const; | 499 template <> void ConstantInteger::emit(GlobalContext *Ctx) const; |
497 template <> void ConstantFloat::emit(GlobalContext *Ctx) const; | 500 template <> void ConstantFloat::emit(GlobalContext *Ctx) const; |
498 template <> void ConstantDouble::emit(GlobalContext *Ctx) const; | 501 template <> void ConstantDouble::emit(GlobalContext *Ctx) const; |
499 | 502 |
500 } // end of namespace Ice | 503 } // end of namespace Ice |
501 | 504 |
502 #endif // SUBZERO_SRC_ICETARGETLOWERINGX8632_H | 505 #endif // SUBZERO_SRC_ICETARGETLOWERINGX8632_H |
OLD | NEW |