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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 } | 50 } |
51 size_t typeWidthInBytesOnStack(Type Ty) const override { | 51 size_t typeWidthInBytesOnStack(Type Ty) const override { |
52 // Round up to the next multiple of 4 bytes. In particular, i1, | 52 // Round up to the next multiple of 4 bytes. In particular, i1, |
53 // i8, and i16 are rounded up to 4 bytes. | 53 // i8, and i16 are rounded up to 4 bytes. |
54 return (typeWidthInBytes(Ty) + 3) & ~3; | 54 return (typeWidthInBytes(Ty) + 3) & ~3; |
55 } | 55 } |
56 void emitVariable(const Variable *Var) const override; | 56 void emitVariable(const Variable *Var) const override; |
57 void lowerArguments() override; | 57 void lowerArguments() override; |
58 void addProlog(CfgNode *Node) override; | 58 void addProlog(CfgNode *Node) override; |
59 void addEpilog(CfgNode *Node) override; | 59 void addEpilog(CfgNode *Node) override; |
60 SizeT makeNextLabelNumber() { return NextLabelNumber++; } | |
61 // Ensure that a 64-bit Variable has been split into 2 32-bit | 60 // Ensure that a 64-bit Variable has been split into 2 32-bit |
62 // Variables, creating them if necessary. This is needed for all | 61 // Variables, creating them if necessary. This is needed for all |
63 // I64 operations, and it is needed for pushing F64 arguments for | 62 // I64 operations, and it is needed for pushing F64 arguments for |
64 // function calls using the 32-bit push instruction (though the | 63 // function calls using the 32-bit push instruction (though the |
65 // latter could be done by directly writing to the stack). | 64 // latter could be done by directly writing to the stack). |
66 void split64(Variable *Var); | 65 void split64(Variable *Var); |
67 void finishArgumentLowering(Variable *Arg, Variable *FramePtr, | 66 void finishArgumentLowering(Variable *Arg, Variable *FramePtr, |
68 size_t BasicFrameOffset, size_t &InArgsSizeBytes); | 67 size_t BasicFrameOffset, size_t &InArgsSizeBytes); |
69 Operand *loOperand(Operand *Operand); | 68 Operand *loOperand(Operand *Operand); |
70 Operand *hiOperand(Operand *Operand); | 69 Operand *hiOperand(Operand *Operand); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 typedef uint32_t LegalMask; | 148 typedef uint32_t LegalMask; |
150 Operand *legalize(Operand *From, LegalMask Allowed = Legal_All, | 149 Operand *legalize(Operand *From, LegalMask Allowed = Legal_All, |
151 int32_t RegNum = Variable::NoRegister); | 150 int32_t RegNum = Variable::NoRegister); |
152 Variable *legalizeToVar(Operand *From, int32_t RegNum = Variable::NoRegister); | 151 Variable *legalizeToVar(Operand *From, int32_t RegNum = Variable::NoRegister); |
153 // Turn a pointer operand into a memory operand that can be | 152 // Turn a pointer operand into a memory operand that can be |
154 // used by a real load/store operation. Legalizes the operand as well. | 153 // used by a real load/store operation. Legalizes the operand as well. |
155 // This is a nop if the operand is already a legal memory operand. | 154 // This is a nop if the operand is already a legal memory operand. |
156 OperandX8632Mem *FormMemoryOperand(Operand *Ptr, Type Ty); | 155 OperandX8632Mem *FormMemoryOperand(Operand *Ptr, Type Ty); |
157 | 156 |
158 Variable *makeReg(Type Ty, int32_t RegNum = Variable::NoRegister); | 157 Variable *makeReg(Type Ty, int32_t RegNum = Variable::NoRegister); |
159 // Make a call to an external helper function. | |
160 InstCall *makeHelperCall(const IceString &Name, Variable *Dest, | |
161 SizeT MaxSrcs) { | |
162 const bool HasTailCall = false; | |
163 Constant *CallTarget = Ctx->getConstantExternSym(Name); | |
164 InstCall *Call = | |
165 InstCall::create(Func, MaxSrcs, Dest, CallTarget, HasTailCall); | |
166 return Call; | |
167 } | |
168 static Type stackSlotType(); | 158 static Type stackSlotType(); |
169 | 159 |
170 Variable *copyToReg(Operand *Src, int32_t RegNum = Variable::NoRegister); | 160 Variable *copyToReg(Operand *Src, int32_t RegNum = Variable::NoRegister); |
171 | 161 |
172 // Returns a vector in a register with the given constant entries. | 162 // Returns a vector in a register with the given constant entries. |
173 Variable *makeVectorOfZeros(Type Ty, int32_t RegNum = Variable::NoRegister); | 163 Variable *makeVectorOfZeros(Type Ty, int32_t RegNum = Variable::NoRegister); |
174 Variable *makeVectorOfOnes(Type Ty, int32_t RegNum = Variable::NoRegister); | 164 Variable *makeVectorOfOnes(Type Ty, int32_t RegNum = Variable::NoRegister); |
175 Variable *makeVectorOfMinusOnes(Type Ty, | 165 Variable *makeVectorOfMinusOnes(Type Ty, |
176 int32_t RegNum = Variable::NoRegister); | 166 int32_t RegNum = Variable::NoRegister); |
177 Variable *makeVectorOfHighOrderBits(Type Ty, | 167 Variable *makeVectorOfHighOrderBits(Type Ty, |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 } | 484 } |
495 | 485 |
496 const X86InstructionSet InstructionSet; | 486 const X86InstructionSet InstructionSet; |
497 bool IsEbpBasedFrame; | 487 bool IsEbpBasedFrame; |
498 bool NeedsStackAlignment; | 488 bool NeedsStackAlignment; |
499 size_t FrameSizeLocals; | 489 size_t FrameSizeLocals; |
500 size_t SpillAreaSizeBytes; | 490 size_t SpillAreaSizeBytes; |
501 llvm::SmallBitVector TypeToRegisterSet[IceType_NUM]; | 491 llvm::SmallBitVector TypeToRegisterSet[IceType_NUM]; |
502 llvm::SmallBitVector ScratchRegs; | 492 llvm::SmallBitVector ScratchRegs; |
503 llvm::SmallBitVector RegsUsed; | 493 llvm::SmallBitVector RegsUsed; |
504 SizeT NextLabelNumber; | |
505 VarList PhysicalRegisters[IceType_NUM]; | 494 VarList PhysicalRegisters[IceType_NUM]; |
506 static IceString RegNames[]; | 495 static IceString RegNames[]; |
507 | 496 |
508 private: | 497 private: |
509 ~TargetX8632() override {} | 498 ~TargetX8632() override {} |
510 }; | 499 }; |
511 | 500 |
512 class TargetDataX8632 : public TargetDataLowering { | 501 class TargetDataX8632 : public TargetDataLowering { |
513 TargetDataX8632() = delete; | 502 TargetDataX8632() = delete; |
514 TargetDataX8632(const TargetDataX8632 &) = delete; | 503 TargetDataX8632(const TargetDataX8632 &) = delete; |
(...skipping 17 matching lines...) Expand all Loading... |
532 }; | 521 }; |
533 | 522 |
534 template <> void ConstantInteger32::emit(GlobalContext *Ctx) const; | 523 template <> void ConstantInteger32::emit(GlobalContext *Ctx) const; |
535 template <> void ConstantInteger64::emit(GlobalContext *Ctx) const; | 524 template <> void ConstantInteger64::emit(GlobalContext *Ctx) const; |
536 template <> void ConstantFloat::emit(GlobalContext *Ctx) const; | 525 template <> void ConstantFloat::emit(GlobalContext *Ctx) const; |
537 template <> void ConstantDouble::emit(GlobalContext *Ctx) const; | 526 template <> void ConstantDouble::emit(GlobalContext *Ctx) const; |
538 | 527 |
539 } // end of namespace Ice | 528 } // end of namespace Ice |
540 | 529 |
541 #endif // SUBZERO_SRC_ICETARGETLOWERINGX8632_H | 530 #endif // SUBZERO_SRC_ICETARGETLOWERINGX8632_H |
OLD | NEW |