| OLD | NEW |
| 1 //===- subzero/src/IceTargetLowering.h - Lowering interface -----*- C++ -*-===// | 1 //===- subzero/src/IceTargetLowering.h - Lowering interface -----*- 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 TargetLowering and LoweringContext | 10 // This file declares the TargetLowering and LoweringContext |
| 11 // classes. TargetLowering is an abstract class used to drive the | 11 // classes. TargetLowering is an abstract class used to drive the |
| 12 // translation/lowering process. LoweringContext maintains a | 12 // translation/lowering process. LoweringContext maintains a |
| 13 // context for lowering each instruction, offering conveniences such | 13 // context for lowering each instruction, offering conveniences such |
| 14 // as iterating over non-deleted instructions. | 14 // as iterating over non-deleted instructions. |
| 15 // | 15 // |
| 16 //===----------------------------------------------------------------------===// | 16 //===----------------------------------------------------------------------===// |
| 17 | 17 |
| 18 #ifndef SUBZERO_SRC_ICETARGETLOWERING_H | 18 #ifndef SUBZERO_SRC_ICETARGETLOWERING_H |
| 19 #define SUBZERO_SRC_ICETARGETLOWERING_H | 19 #define SUBZERO_SRC_ICETARGETLOWERING_H |
| 20 | 20 |
| 21 #include "IceDefs.h" | 21 #include "IceDefs.h" |
| 22 #include "IceInst.h" // for the names of the Inst subtypes | 22 #include "IceInst.h" // for the names of the Inst subtypes |
| 23 #include "IceTypes.h" | 23 #include "IceTypes.h" |
| 24 | 24 |
| 25 namespace Ice { | 25 namespace Ice { |
| 26 | 26 |
| 27 typedef uint8_t AsmCodeByte; | |
| 28 | |
| 29 class Assembler; | 27 class Assembler; |
| 30 | 28 |
| 31 // LoweringContext makes it easy to iterate through non-deleted | 29 // LoweringContext makes it easy to iterate through non-deleted |
| 32 // instructions in a node, and insert new (lowered) instructions at | 30 // instructions in a node, and insert new (lowered) instructions at |
| 33 // the current point. Along with the instruction list container and | 31 // the current point. Along with the instruction list container and |
| 34 // associated iterators, it holds the current node, which is needed | 32 // associated iterators, it holds the current node, which is needed |
| 35 // when inserting new instructions in order to track whether variables | 33 // when inserting new instructions in order to track whether variables |
| 36 // are used as single-block or multi-block. | 34 // are used as single-block or multi-block. |
| 37 class LoweringContext { | 35 class LoweringContext { |
| 38 LoweringContext(const LoweringContext &) = delete; | 36 LoweringContext(const LoweringContext &) = delete; |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 // scratch registers as killed by a call. If a Type is not | 156 // scratch registers as killed by a call. If a Type is not |
| 159 // provided, a target-specific default type is used. | 157 // provided, a target-specific default type is used. |
| 160 virtual Variable *getPhysicalRegister(SizeT RegNum, | 158 virtual Variable *getPhysicalRegister(SizeT RegNum, |
| 161 Type Ty = IceType_void) = 0; | 159 Type Ty = IceType_void) = 0; |
| 162 // Returns a printable name for the register. | 160 // Returns a printable name for the register. |
| 163 virtual IceString getRegName(SizeT RegNum, Type Ty) const = 0; | 161 virtual IceString getRegName(SizeT RegNum, Type Ty) const = 0; |
| 164 | 162 |
| 165 virtual bool hasFramePointer() const { return false; } | 163 virtual bool hasFramePointer() const { return false; } |
| 166 virtual SizeT getFrameOrStackReg() const = 0; | 164 virtual SizeT getFrameOrStackReg() const = 0; |
| 167 virtual size_t typeWidthInBytesOnStack(Type Ty) const = 0; | 165 virtual size_t typeWidthInBytesOnStack(Type Ty) const = 0; |
| 168 virtual SizeT getBundleAlignLog2Bytes() const = 0; | |
| 169 virtual llvm::ArrayRef<AsmCodeByte> getNonExecBundlePadding() const = 0; | |
| 170 bool hasComputedFrame() const { return HasComputedFrame; } | 166 bool hasComputedFrame() const { return HasComputedFrame; } |
| 171 bool shouldDoNopInsertion() const; | 167 bool shouldDoNopInsertion() const; |
| 172 // Returns true if this function calls a function that has the | 168 // Returns true if this function calls a function that has the |
| 173 // "returns twice" attribute. | 169 // "returns twice" attribute. |
| 174 bool callsReturnsTwice() const { return CallsReturnsTwice; } | 170 bool callsReturnsTwice() const { return CallsReturnsTwice; } |
| 175 void setCallsReturnsTwice(bool RetTwice) { | 171 void setCallsReturnsTwice(bool RetTwice) { |
| 176 CallsReturnsTwice = RetTwice; | 172 CallsReturnsTwice = RetTwice; |
| 177 } | 173 } |
| 178 int32_t getStackAdjustment() const { return StackAdjustment; } | 174 int32_t getStackAdjustment() const { return StackAdjustment; } |
| 179 void updateStackAdjustment(int32_t Offset) { StackAdjustment += Offset; } | 175 void updateStackAdjustment(int32_t Offset) { StackAdjustment += Offset; } |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 virtual void lower(const VariableDeclaration &Var) = 0; | 259 virtual void lower(const VariableDeclaration &Var) = 0; |
| 264 | 260 |
| 265 protected: | 261 protected: |
| 266 TargetGlobalInitLowering(GlobalContext *Ctx) : Ctx(Ctx) {} | 262 TargetGlobalInitLowering(GlobalContext *Ctx) : Ctx(Ctx) {} |
| 267 GlobalContext *Ctx; | 263 GlobalContext *Ctx; |
| 268 }; | 264 }; |
| 269 | 265 |
| 270 } // end of namespace Ice | 266 } // end of namespace Ice |
| 271 | 267 |
| 272 #endif // SUBZERO_SRC_ICETARGETLOWERING_H | 268 #endif // SUBZERO_SRC_ICETARGETLOWERING_H |
| OLD | NEW |