OLD | NEW |
1 //===- subzero/src/IceCfg.h - Control flow graph ----------------*- C++ -*-===// | 1 //===- subzero/src/IceCfg.h - Control flow graph ----------------*- 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 /// \file | 10 /// \file |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 /// instructions from the Cfg, to speed up later passes over the instructions. | 195 /// instructions from the Cfg, to speed up later passes over the instructions. |
196 void renumberInstructions(); | 196 void renumberInstructions(); |
197 void placePhiLoads(); | 197 void placePhiLoads(); |
198 void placePhiStores(); | 198 void placePhiStores(); |
199 void deletePhis(); | 199 void deletePhis(); |
200 void advancedPhiLowering(); | 200 void advancedPhiLowering(); |
201 void reorderNodes(); | 201 void reorderNodes(); |
202 void shuffleNodes(); | 202 void shuffleNodes(); |
203 void localCSE(); | 203 void localCSE(); |
204 void shortCircuitJumps(); | 204 void shortCircuitJumps(); |
| 205 void loopInvariantCodeMotion(); |
205 | 206 |
206 /// Scan allocas to determine whether we need to use a frame pointer. | 207 /// Scan allocas to determine whether we need to use a frame pointer. |
207 /// If SortAndCombine == true, merge all the fixed-size allocas in the | 208 /// If SortAndCombine == true, merge all the fixed-size allocas in the |
208 /// entry block and emit stack or frame pointer-relative addressing. | 209 /// entry block and emit stack or frame pointer-relative addressing. |
209 void processAllocas(bool SortAndCombine); | 210 void processAllocas(bool SortAndCombine); |
210 void doAddressOpt(); | 211 void doAddressOpt(); |
211 /// Find clusters of insertelement/extractelement instructions that can be | 212 /// Find clusters of insertelement/extractelement instructions that can be |
212 /// replaced by a shufflevector instruction. | 213 /// replaced by a shufflevector instruction. |
213 void materializeVectorShuffles(); | 214 void materializeVectorShuffles(); |
214 void doArgLowering(); | 215 void doArgLowering(); |
215 void doNopInsertion(); | 216 void doNopInsertion(); |
216 void genCode(); | 217 void genCode(); |
217 void genFrame(); | 218 void genFrame(); |
218 void computeLoopNestDepth(); | 219 void generateLoopInfo(); |
219 void livenessLightweight(); | 220 void livenessLightweight(); |
220 void liveness(LivenessMode Mode); | 221 void liveness(LivenessMode Mode); |
221 bool validateLiveness() const; | 222 bool validateLiveness() const; |
222 void contractEmptyNodes(); | 223 void contractEmptyNodes(); |
223 void doBranchOpt(); | 224 void doBranchOpt(); |
224 void markNodesForSandboxing(); | 225 void markNodesForSandboxing(); |
225 | 226 |
226 /// \name Manage the CurrentNode field. | 227 /// \name Manage the CurrentNode field. |
227 /// CurrentNode is used for validating the Variable::DefNode field during | 228 /// CurrentNode is used for validating the Variable::DefNode field during |
228 /// dumping/emitting. | 229 /// dumping/emitting. |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 | 294 |
294 enum AllocaBaseVariableType { | 295 enum AllocaBaseVariableType { |
295 BVT_StackPointer, | 296 BVT_StackPointer, |
296 BVT_FramePointer, | 297 BVT_FramePointer, |
297 BVT_UserPointer | 298 BVT_UserPointer |
298 }; | 299 }; |
299 void sortAndCombineAllocas(CfgVector<InstAlloca *> &Allocas, | 300 void sortAndCombineAllocas(CfgVector<InstAlloca *> &Allocas, |
300 uint32_t CombinedAlignment, InstList &Insts, | 301 uint32_t CombinedAlignment, InstList &Insts, |
301 AllocaBaseVariableType BaseVariableType); | 302 AllocaBaseVariableType BaseVariableType); |
302 void findRematerializable(); | 303 void findRematerializable(); |
| 304 CfgVector<Inst *> findLoopInvariantInstructions(SizeT LoopHeaderIndex); |
303 | 305 |
304 GlobalContext *Ctx; | 306 GlobalContext *Ctx; |
305 uint32_t SequenceNumber; /// output order for emission | 307 uint32_t SequenceNumber; /// output order for emission |
306 OptLevel OptimizationLevel = Opt_m1; | 308 OptLevel OptimizationLevel = Opt_m1; |
307 uint32_t ConstantBlindingCookie = 0; /// cookie for constant blinding | 309 uint32_t ConstantBlindingCookie = 0; /// cookie for constant blinding |
308 VerboseMask VMask; | 310 VerboseMask VMask; |
309 GlobalString FunctionName; | 311 GlobalString FunctionName; |
310 Type ReturnType = IceType_void; | 312 Type ReturnType = IceType_void; |
311 bool IsInternalLinkage = false; | 313 bool IsInternalLinkage = false; |
312 bool HasError = false; | 314 bool HasError = false; |
(...skipping 10 matching lines...) Expand all Loading... |
323 // of the uniqueness requirement, and assumptions in lit tests. | 325 // of the uniqueness requirement, and assumptions in lit tests. |
324 std::unique_ptr<StringPool> NodeStrings; | 326 std::unique_ptr<StringPool> NodeStrings; |
325 std::unique_ptr<StringPool> VarStrings; | 327 std::unique_ptr<StringPool> VarStrings; |
326 std::unique_ptr<Liveness> Live; | 328 std::unique_ptr<Liveness> Live; |
327 std::unique_ptr<TargetLowering> Target; | 329 std::unique_ptr<TargetLowering> Target; |
328 std::unique_ptr<VariablesMetadata> VMetadata; | 330 std::unique_ptr<VariablesMetadata> VMetadata; |
329 std::unique_ptr<Assembler> TargetAssembler; | 331 std::unique_ptr<Assembler> TargetAssembler; |
330 /// Globals required by this CFG. Mostly used for the profiler's globals. | 332 /// Globals required by this CFG. Mostly used for the profiler's globals. |
331 std::unique_ptr<VariableDeclarationList> GlobalInits; | 333 std::unique_ptr<VariableDeclarationList> GlobalInits; |
332 CfgVector<InstJumpTable *> JumpTables; | 334 CfgVector<InstJumpTable *> JumpTables; |
333 | 335 CfgUnorderedMap<SizeT, CfgVector<SizeT>> LoopInfo; |
334 /// CurrentNode is maintained during dumping/emitting just for validating | 336 /// CurrentNode is maintained during dumping/emitting just for validating |
335 /// Variable::DefNode. Normally, a traversal over CfgNodes maintains this, but | 337 /// Variable::DefNode. Normally, a traversal over CfgNodes maintains this, but |
336 /// before global operations like register allocation, resetCurrentNode() | 338 /// before global operations like register allocation, resetCurrentNode() |
337 /// should be called to avoid spurious validation failures. | 339 /// should be called to avoid spurious validation failures. |
338 const CfgNode *CurrentNode = nullptr; | 340 const CfgNode *CurrentNode = nullptr; |
339 | 341 |
340 public: | 342 public: |
341 static void TlsInit() { CfgAllocatorTraits::init(); } | 343 static void TlsInit() { CfgAllocatorTraits::init(); } |
342 }; | 344 }; |
343 | 345 |
(...skipping 11 matching lines...) Expand all Loading... |
355 using OwnerType = Cfg; | 357 using OwnerType = Cfg; |
356 static StringPool *getStrings(const OwnerType *PoolOwner) { | 358 static StringPool *getStrings(const OwnerType *PoolOwner) { |
357 return PoolOwner->getVarStrings(); | 359 return PoolOwner->getVarStrings(); |
358 } | 360 } |
359 }; | 361 }; |
360 using VariableString = StringID<VariableStringPoolTraits>; | 362 using VariableString = StringID<VariableStringPoolTraits>; |
361 | 363 |
362 } // end of namespace Ice | 364 } // end of namespace Ice |
363 | 365 |
364 #endif // SUBZERO_SRC_ICECFG_H | 366 #endif // SUBZERO_SRC_ICECFG_H |
OLD | NEW |