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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
114 } | 114 } |
115 virtual void translateO1() { | 115 virtual void translateO1() { |
116 Func->setError("Target doesn't specify O1 lowering steps."); | 116 Func->setError("Target doesn't specify O1 lowering steps."); |
117 } | 117 } |
118 virtual void translateO2() { | 118 virtual void translateO2() { |
119 Func->setError("Target doesn't specify O2 lowering steps."); | 119 Func->setError("Target doesn't specify O2 lowering steps."); |
120 } | 120 } |
121 | 121 |
122 // Tries to do address mode optimization on a single instruction. | 122 // Tries to do address mode optimization on a single instruction. |
123 void doAddressOpt(); | 123 void doAddressOpt(); |
124 // Randomly insert NOPs. | |
125 void doNopInsertion(); | |
124 // Lowers a single instruction. | 126 // Lowers a single instruction. |
125 void lower(); | 127 void lower(); |
126 | 128 |
127 // Returns a variable pre-colored to the specified physical | 129 // Returns a variable pre-colored to the specified physical |
128 // register. This is generally used to get very direct access to | 130 // register. This is generally used to get very direct access to |
129 // the register such as in the prolog or epilog or for marking | 131 // the register such as in the prolog or epilog or for marking |
130 // scratch registers as killed by a call. | 132 // scratch registers as killed by a call. |
131 virtual Variable *getPhysicalRegister(SizeT RegNum) = 0; | 133 virtual Variable *getPhysicalRegister(SizeT RegNum) = 0; |
132 // Returns a printable name for the register. | 134 // Returns a printable name for the register. |
133 virtual IceString getRegName(SizeT RegNum, Type Ty) const = 0; | 135 virtual IceString getRegName(SizeT RegNum, Type Ty) const = 0; |
134 | 136 |
135 virtual bool hasFramePointer() const { return false; } | 137 virtual bool hasFramePointer() const { return false; } |
136 virtual SizeT getFrameOrStackReg() const = 0; | 138 virtual SizeT getFrameOrStackReg() const = 0; |
137 virtual size_t typeWidthInBytesOnStack(Type Ty) const = 0; | 139 virtual size_t typeWidthInBytesOnStack(Type Ty) const = 0; |
138 bool hasComputedFrame() const { return HasComputedFrame; } | 140 bool hasComputedFrame() const { return HasComputedFrame; } |
141 bool shouldDoNopInsertion() const; | |
139 int32_t getStackAdjustment() const { return StackAdjustment; } | 142 int32_t getStackAdjustment() const { return StackAdjustment; } |
140 void updateStackAdjustment(int32_t Offset) { StackAdjustment += Offset; } | 143 void updateStackAdjustment(int32_t Offset) { StackAdjustment += Offset; } |
141 void resetStackAdjustment() { StackAdjustment = 0; } | 144 void resetStackAdjustment() { StackAdjustment = 0; } |
142 LoweringContext &getContext() { return Context; } | 145 LoweringContext &getContext() { return Context; } |
143 | 146 |
144 enum RegSet { | 147 enum RegSet { |
145 RegSet_None = 0, | 148 RegSet_None = 0, |
146 RegSet_CallerSave = 1 << 0, | 149 RegSet_CallerSave = 1 << 0, |
147 RegSet_CalleeSave = 1 << 1, | 150 RegSet_CalleeSave = 1 << 1, |
148 RegSet_StackPointer = 1 << 2, | 151 RegSet_StackPointer = 1 << 2, |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
186 virtual void lowerLoad(const InstLoad *Inst) = 0; | 189 virtual void lowerLoad(const InstLoad *Inst) = 0; |
187 virtual void lowerPhi(const InstPhi *Inst) = 0; | 190 virtual void lowerPhi(const InstPhi *Inst) = 0; |
188 virtual void lowerRet(const InstRet *Inst) = 0; | 191 virtual void lowerRet(const InstRet *Inst) = 0; |
189 virtual void lowerSelect(const InstSelect *Inst) = 0; | 192 virtual void lowerSelect(const InstSelect *Inst) = 0; |
190 virtual void lowerStore(const InstStore *Inst) = 0; | 193 virtual void lowerStore(const InstStore *Inst) = 0; |
191 virtual void lowerSwitch(const InstSwitch *Inst) = 0; | 194 virtual void lowerSwitch(const InstSwitch *Inst) = 0; |
192 virtual void lowerUnreachable(const InstUnreachable *Inst) = 0; | 195 virtual void lowerUnreachable(const InstUnreachable *Inst) = 0; |
193 | 196 |
194 virtual void doAddressOptLoad() {} | 197 virtual void doAddressOptLoad() {} |
195 virtual void doAddressOptStore() {} | 198 virtual void doAddressOptStore() {} |
199 virtual void randomlyInsertNop(float) {} | |
Jim Stichnoth
2014/08/15 14:07:08
float Probability
wala
2014/08/15 17:57:49
Done.
| |
196 // This gives the target an opportunity to post-process the lowered | 200 // This gives the target an opportunity to post-process the lowered |
197 // expansion before returning. The primary intention is to do some | 201 // expansion before returning. The primary intention is to do some |
198 // Register Manager activity as necessary, specifically to eagerly | 202 // Register Manager activity as necessary, specifically to eagerly |
199 // allocate registers based on affinity and other factors. The | 203 // allocate registers based on affinity and other factors. The |
200 // simplest lowering does nothing here and leaves it all to a | 204 // simplest lowering does nothing here and leaves it all to a |
201 // subsequent global register allocation pass. | 205 // subsequent global register allocation pass. |
202 virtual void postLower() {} | 206 virtual void postLower() {} |
203 | 207 |
204 Cfg *Func; | 208 Cfg *Func; |
205 GlobalContext *Ctx; | 209 GlobalContext *Ctx; |
(...skipping 29 matching lines...) Expand all Loading... | |
235 private: | 239 private: |
236 TargetGlobalInitLowering(const TargetGlobalInitLowering &) | 240 TargetGlobalInitLowering(const TargetGlobalInitLowering &) |
237 LLVM_DELETED_FUNCTION; | 241 LLVM_DELETED_FUNCTION; |
238 TargetGlobalInitLowering & | 242 TargetGlobalInitLowering & |
239 operator=(const TargetGlobalInitLowering &) LLVM_DELETED_FUNCTION; | 243 operator=(const TargetGlobalInitLowering &) LLVM_DELETED_FUNCTION; |
240 }; | 244 }; |
241 | 245 |
242 } // end of namespace Ice | 246 } // end of namespace Ice |
243 | 247 |
244 #endif // SUBZERO_SRC_ICETARGETLOWERING_H | 248 #endif // SUBZERO_SRC_ICETARGETLOWERING_H |
OLD | NEW |