| 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 |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 // Returns a printable name for the register. | 134 // Returns a printable name for the register. |
| 135 virtual IceString getRegName(SizeT RegNum, Type Ty) const = 0; | 135 virtual IceString getRegName(SizeT RegNum, Type Ty) const = 0; |
| 136 | 136 |
| 137 virtual bool hasFramePointer() const { return false; } | 137 virtual bool hasFramePointer() const { return false; } |
| 138 virtual SizeT getFrameOrStackReg() const = 0; | 138 virtual SizeT getFrameOrStackReg() const = 0; |
| 139 virtual size_t typeWidthInBytesOnStack(Type Ty) const = 0; | 139 virtual size_t typeWidthInBytesOnStack(Type Ty) const = 0; |
| 140 virtual SizeT getBundleAlignLog2Bytes() const = 0; | 140 virtual SizeT getBundleAlignLog2Bytes() const = 0; |
| 141 virtual llvm::ArrayRef<uint8_t> getNonExecBundlePadding() const = 0; | 141 virtual llvm::ArrayRef<uint8_t> getNonExecBundlePadding() const = 0; |
| 142 bool hasComputedFrame() const { return HasComputedFrame; } | 142 bool hasComputedFrame() const { return HasComputedFrame; } |
| 143 bool shouldDoNopInsertion() const; | 143 bool shouldDoNopInsertion() const; |
| 144 // Returns true if this function calls a function that has the |
| 145 // "returns twice" attribute. |
| 146 bool callsReturnsTwice() const { return CallsReturnsTwice; } |
| 147 void setCallsReturnsTwice(bool RetTwice) { |
| 148 CallsReturnsTwice = RetTwice; |
| 149 } |
| 144 int32_t getStackAdjustment() const { return StackAdjustment; } | 150 int32_t getStackAdjustment() const { return StackAdjustment; } |
| 145 void updateStackAdjustment(int32_t Offset) { StackAdjustment += Offset; } | 151 void updateStackAdjustment(int32_t Offset) { StackAdjustment += Offset; } |
| 146 void resetStackAdjustment() { StackAdjustment = 0; } | 152 void resetStackAdjustment() { StackAdjustment = 0; } |
| 147 LoweringContext &getContext() { return Context; } | 153 LoweringContext &getContext() { return Context; } |
| 148 | 154 |
| 149 enum RegSet { | 155 enum RegSet { |
| 150 RegSet_None = 0, | 156 RegSet_None = 0, |
| 151 RegSet_CallerSave = 1 << 0, | 157 RegSet_CallerSave = 1 << 0, |
| 152 RegSet_CalleeSave = 1 << 1, | 158 RegSet_CalleeSave = 1 << 1, |
| 153 RegSet_StackPointer = 1 << 2, | 159 RegSet_StackPointer = 1 << 2, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 169 virtual void addProlog(CfgNode *Node) = 0; | 175 virtual void addProlog(CfgNode *Node) = 0; |
| 170 virtual void addEpilog(CfgNode *Node) = 0; | 176 virtual void addEpilog(CfgNode *Node) = 0; |
| 171 | 177 |
| 172 virtual void emitConstants() const = 0; | 178 virtual void emitConstants() const = 0; |
| 173 | 179 |
| 174 virtual ~TargetLowering() {} | 180 virtual ~TargetLowering() {} |
| 175 | 181 |
| 176 protected: | 182 protected: |
| 177 TargetLowering(Cfg *Func) | 183 TargetLowering(Cfg *Func) |
| 178 : Func(Func), Ctx(Func->getContext()), HasComputedFrame(false), | 184 : Func(Func), Ctx(Func->getContext()), HasComputedFrame(false), |
| 179 StackAdjustment(0) {} | 185 CallsReturnsTwice(false), StackAdjustment(0) {} |
| 180 virtual void lowerAlloca(const InstAlloca *Inst) = 0; | 186 virtual void lowerAlloca(const InstAlloca *Inst) = 0; |
| 181 virtual void lowerArithmetic(const InstArithmetic *Inst) = 0; | 187 virtual void lowerArithmetic(const InstArithmetic *Inst) = 0; |
| 182 virtual void lowerAssign(const InstAssign *Inst) = 0; | 188 virtual void lowerAssign(const InstAssign *Inst) = 0; |
| 183 virtual void lowerBr(const InstBr *Inst) = 0; | 189 virtual void lowerBr(const InstBr *Inst) = 0; |
| 184 virtual void lowerCall(const InstCall *Inst) = 0; | 190 virtual void lowerCall(const InstCall *Inst) = 0; |
| 185 virtual void lowerCast(const InstCast *Inst) = 0; | 191 virtual void lowerCast(const InstCast *Inst) = 0; |
| 186 virtual void lowerFcmp(const InstFcmp *Inst) = 0; | 192 virtual void lowerFcmp(const InstFcmp *Inst) = 0; |
| 187 virtual void lowerExtractElement(const InstExtractElement *Inst) = 0; | 193 virtual void lowerExtractElement(const InstExtractElement *Inst) = 0; |
| 188 virtual void lowerIcmp(const InstIcmp *Inst) = 0; | 194 virtual void lowerIcmp(const InstIcmp *Inst) = 0; |
| 189 virtual void lowerInsertElement(const InstInsertElement *Inst) = 0; | 195 virtual void lowerInsertElement(const InstInsertElement *Inst) = 0; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 203 // expansion before returning. The primary intention is to do some | 209 // expansion before returning. The primary intention is to do some |
| 204 // Register Manager activity as necessary, specifically to eagerly | 210 // Register Manager activity as necessary, specifically to eagerly |
| 205 // allocate registers based on affinity and other factors. The | 211 // allocate registers based on affinity and other factors. The |
| 206 // simplest lowering does nothing here and leaves it all to a | 212 // simplest lowering does nothing here and leaves it all to a |
| 207 // subsequent global register allocation pass. | 213 // subsequent global register allocation pass. |
| 208 virtual void postLower() {} | 214 virtual void postLower() {} |
| 209 | 215 |
| 210 Cfg *Func; | 216 Cfg *Func; |
| 211 GlobalContext *Ctx; | 217 GlobalContext *Ctx; |
| 212 bool HasComputedFrame; | 218 bool HasComputedFrame; |
| 219 bool CallsReturnsTwice; |
| 213 // StackAdjustment keeps track of the current stack offset from its | 220 // StackAdjustment keeps track of the current stack offset from its |
| 214 // natural location, as arguments are pushed for a function call. | 221 // natural location, as arguments are pushed for a function call. |
| 215 int32_t StackAdjustment; | 222 int32_t StackAdjustment; |
| 216 LoweringContext Context; | 223 LoweringContext Context; |
| 217 | 224 |
| 218 private: | 225 private: |
| 219 TargetLowering(const TargetLowering &) LLVM_DELETED_FUNCTION; | 226 TargetLowering(const TargetLowering &) LLVM_DELETED_FUNCTION; |
| 220 TargetLowering &operator=(const TargetLowering &) LLVM_DELETED_FUNCTION; | 227 TargetLowering &operator=(const TargetLowering &) LLVM_DELETED_FUNCTION; |
| 221 }; | 228 }; |
| 222 | 229 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 241 private: | 248 private: |
| 242 TargetGlobalInitLowering(const TargetGlobalInitLowering &) | 249 TargetGlobalInitLowering(const TargetGlobalInitLowering &) |
| 243 LLVM_DELETED_FUNCTION; | 250 LLVM_DELETED_FUNCTION; |
| 244 TargetGlobalInitLowering & | 251 TargetGlobalInitLowering & |
| 245 operator=(const TargetGlobalInitLowering &) LLVM_DELETED_FUNCTION; | 252 operator=(const TargetGlobalInitLowering &) LLVM_DELETED_FUNCTION; |
| 246 }; | 253 }; |
| 247 | 254 |
| 248 } // end of namespace Ice | 255 } // end of namespace Ice |
| 249 | 256 |
| 250 #endif // SUBZERO_SRC_ICETARGETLOWERING_H | 257 #endif // SUBZERO_SRC_ICETARGETLOWERING_H |
| OLD | NEW |