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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 } | 49 } |
50 size_t typeWidthInBytesOnStack(Type Ty) const override { | 50 size_t typeWidthInBytesOnStack(Type Ty) const override { |
51 // Round up to the next multiple of 4 bytes. In particular, i1, | 51 // Round up to the next multiple of 4 bytes. In particular, i1, |
52 // i8, and i16 are rounded up to 4 bytes. | 52 // i8, and i16 are rounded up to 4 bytes. |
53 return (typeWidthInBytes(Ty) + 3) & ~3; | 53 return (typeWidthInBytes(Ty) + 3) & ~3; |
54 } | 54 } |
55 void emitVariable(const Variable *Var) const override; | 55 void emitVariable(const Variable *Var) const override; |
56 void lowerArguments() override; | 56 void lowerArguments() override; |
57 void addProlog(CfgNode *Node) override; | 57 void addProlog(CfgNode *Node) override; |
58 void addEpilog(CfgNode *Node) override; | 58 void addEpilog(CfgNode *Node) override; |
59 void emitConstants() const override; | |
60 SizeT makeNextLabelNumber() { return NextLabelNumber++; } | 59 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); |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 size_t SpillAreaSizeBytes; | 479 size_t SpillAreaSizeBytes; |
481 llvm::SmallBitVector TypeToRegisterSet[IceType_NUM]; | 480 llvm::SmallBitVector TypeToRegisterSet[IceType_NUM]; |
482 llvm::SmallBitVector ScratchRegs; | 481 llvm::SmallBitVector ScratchRegs; |
483 llvm::SmallBitVector RegsUsed; | 482 llvm::SmallBitVector RegsUsed; |
484 SizeT NextLabelNumber; | 483 SizeT NextLabelNumber; |
485 VarList PhysicalRegisters[IceType_NUM]; | 484 VarList PhysicalRegisters[IceType_NUM]; |
486 static IceString RegNames[]; | 485 static IceString RegNames[]; |
487 | 486 |
488 private: | 487 private: |
489 ~TargetX8632() override {} | 488 ~TargetX8632() override {} |
490 template <typename T> void emitConstantPool() const; | |
491 }; | 489 }; |
492 | 490 |
493 class TargetGlobalInitX8632 : public TargetGlobalInitLowering { | 491 class TargetGlobalX8632 : public TargetGlobalLowering { |
494 TargetGlobalInitX8632(const TargetGlobalInitX8632 &) = delete; | 492 TargetGlobalX8632() = delete; |
495 TargetGlobalInitX8632 &operator=(const TargetGlobalInitX8632 &) = delete; | 493 TargetGlobalX8632(const TargetGlobalX8632 &) = delete; |
| 494 TargetGlobalX8632 &operator=(const TargetGlobalX8632 &) = delete; |
496 | 495 |
497 public: | 496 public: |
498 static TargetGlobalInitLowering *create(GlobalContext *Ctx) { | 497 static TargetGlobalLowering *create(GlobalContext *Ctx) { |
499 return new TargetGlobalInitX8632(Ctx); | 498 return new TargetGlobalX8632(Ctx); |
500 } | 499 } |
501 | 500 |
502 virtual void lower(const VariableDeclaration &Var) final; | 501 virtual void lowerInit(const VariableDeclaration &Var) const final; |
| 502 virtual void lowerConstants(GlobalContext *Ctx) const final; |
503 | 503 |
504 protected: | 504 protected: |
505 TargetGlobalInitX8632(GlobalContext *Ctx); | 505 TargetGlobalX8632(GlobalContext *Ctx); |
506 | 506 |
507 private: | 507 private: |
508 ~TargetGlobalInitX8632() override {} | 508 ~TargetGlobalX8632() override {} |
| 509 template <typename T> static void emitConstantPool(GlobalContext *Ctx); |
509 }; | 510 }; |
510 | 511 |
511 template <> void ConstantInteger32::emit(GlobalContext *Ctx) const; | 512 template <> void ConstantInteger32::emit(GlobalContext *Ctx) const; |
512 template <> void ConstantInteger64::emit(GlobalContext *Ctx) const; | 513 template <> void ConstantInteger64::emit(GlobalContext *Ctx) const; |
513 template <> void ConstantFloat::emit(GlobalContext *Ctx) const; | 514 template <> void ConstantFloat::emit(GlobalContext *Ctx) const; |
514 template <> void ConstantDouble::emit(GlobalContext *Ctx) const; | 515 template <> void ConstantDouble::emit(GlobalContext *Ctx) const; |
515 | 516 |
516 } // end of namespace Ice | 517 } // end of namespace Ice |
517 | 518 |
518 #endif // SUBZERO_SRC_ICETARGETLOWERINGX8632_H | 519 #endif // SUBZERO_SRC_ICETARGETLOWERINGX8632_H |
OLD | NEW |