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 |
11 /// \brief Declares the Cfg class, which represents the control flow graph and | 11 /// \brief Declares the Cfg class, which represents the control flow graph and |
12 /// the overall per-function compilation context. | 12 /// the overall per-function compilation context. |
13 /// | 13 /// |
14 //===----------------------------------------------------------------------===// | 14 //===----------------------------------------------------------------------===// |
15 | 15 |
16 #ifndef SUBZERO_SRC_ICECFG_H | 16 #ifndef SUBZERO_SRC_ICECFG_H |
17 #define SUBZERO_SRC_ICECFG_H | 17 #define SUBZERO_SRC_ICECFG_H |
18 | 18 |
19 #include "IceAssembler.h" | 19 #include "IceAssembler.h" |
20 #include "IceClFlags.h" | 20 #include "IceClFlags.h" |
21 #include "IceDefs.h" | 21 #include "IceDefs.h" |
22 #include "IceGlobalContext.h" | 22 #include "IceGlobalContext.h" |
23 #include "IceStringPool.h" | 23 #include "IceStringPool.h" |
24 #include "IceTypes.h" | 24 #include "IceTypes.h" |
25 #include "IceLoopAnalyzer.h" | |
Jim Stichnoth
2016/07/15 22:14:33
alphabetize includes if possible
manasijm
2016/07/18 22:27:46
Done.
| |
25 | 26 |
26 namespace Ice { | 27 namespace Ice { |
27 | 28 |
28 class Cfg { | 29 class Cfg { |
29 Cfg() = delete; | 30 Cfg() = delete; |
30 Cfg(const Cfg &) = delete; | 31 Cfg(const Cfg &) = delete; |
31 Cfg &operator=(const Cfg &) = delete; | 32 Cfg &operator=(const Cfg &) = delete; |
32 | 33 |
33 public: | 34 public: |
34 ~Cfg(); | 35 ~Cfg(); |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
294 | 295 |
295 enum AllocaBaseVariableType { | 296 enum AllocaBaseVariableType { |
296 BVT_StackPointer, | 297 BVT_StackPointer, |
297 BVT_FramePointer, | 298 BVT_FramePointer, |
298 BVT_UserPointer | 299 BVT_UserPointer |
299 }; | 300 }; |
300 void sortAndCombineAllocas(CfgVector<InstAlloca *> &Allocas, | 301 void sortAndCombineAllocas(CfgVector<InstAlloca *> &Allocas, |
301 uint32_t CombinedAlignment, InstList &Insts, | 302 uint32_t CombinedAlignment, InstList &Insts, |
302 AllocaBaseVariableType BaseVariableType); | 303 AllocaBaseVariableType BaseVariableType); |
303 void findRematerializable(); | 304 void findRematerializable(); |
304 CfgVector<Inst *> findLoopInvariantInstructions(SizeT LoopHeaderIndex); | 305 CfgVector<Inst *> |
306 findLoopInvariantInstructions(const CfgUnorderedSet<SizeT> &Body); | |
305 | 307 |
306 GlobalContext *Ctx; | 308 GlobalContext *Ctx; |
307 uint32_t SequenceNumber; /// output order for emission | 309 uint32_t SequenceNumber; /// output order for emission |
308 OptLevel OptimizationLevel = Opt_m1; | 310 OptLevel OptimizationLevel = Opt_m1; |
309 uint32_t ConstantBlindingCookie = 0; /// cookie for constant blinding | 311 uint32_t ConstantBlindingCookie = 0; /// cookie for constant blinding |
310 VerboseMask VMask; | 312 VerboseMask VMask; |
311 GlobalString FunctionName; | 313 GlobalString FunctionName; |
312 Type ReturnType = IceType_void; | 314 Type ReturnType = IceType_void; |
313 bool IsInternalLinkage = false; | 315 bool IsInternalLinkage = false; |
314 bool HasError = false; | 316 bool HasError = false; |
(...skipping 10 matching lines...) Expand all Loading... | |
325 // of the uniqueness requirement, and assumptions in lit tests. | 327 // of the uniqueness requirement, and assumptions in lit tests. |
326 std::unique_ptr<StringPool> NodeStrings; | 328 std::unique_ptr<StringPool> NodeStrings; |
327 std::unique_ptr<StringPool> VarStrings; | 329 std::unique_ptr<StringPool> VarStrings; |
328 std::unique_ptr<Liveness> Live; | 330 std::unique_ptr<Liveness> Live; |
329 std::unique_ptr<TargetLowering> Target; | 331 std::unique_ptr<TargetLowering> Target; |
330 std::unique_ptr<VariablesMetadata> VMetadata; | 332 std::unique_ptr<VariablesMetadata> VMetadata; |
331 std::unique_ptr<Assembler> TargetAssembler; | 333 std::unique_ptr<Assembler> TargetAssembler; |
332 /// Globals required by this CFG. Mostly used for the profiler's globals. | 334 /// Globals required by this CFG. Mostly used for the profiler's globals. |
333 std::unique_ptr<VariableDeclarationList> GlobalInits; | 335 std::unique_ptr<VariableDeclarationList> GlobalInits; |
334 CfgVector<InstJumpTable *> JumpTables; | 336 CfgVector<InstJumpTable *> JumpTables; |
335 CfgUnorderedMap<SizeT, CfgVector<SizeT>> LoopInfo; | |
336 /// CurrentNode is maintained during dumping/emitting just for validating | 337 /// CurrentNode is maintained during dumping/emitting just for validating |
337 /// Variable::DefNode. Normally, a traversal over CfgNodes maintains this, but | 338 /// Variable::DefNode. Normally, a traversal over CfgNodes maintains this, but |
338 /// before global operations like register allocation, resetCurrentNode() | 339 /// before global operations like register allocation, resetCurrentNode() |
339 /// should be called to avoid spurious validation failures. | 340 /// should be called to avoid spurious validation failures. |
340 const CfgNode *CurrentNode = nullptr; | 341 const CfgNode *CurrentNode = nullptr; |
342 LoopAnalyzer::LoopInfo Loops; | |
341 | 343 |
342 public: | 344 public: |
343 static void TlsInit() { CfgAllocatorTraits::init(); } | 345 static void TlsInit() { CfgAllocatorTraits::init(); } |
344 }; | 346 }; |
345 | 347 |
346 template <> Variable *Cfg::makeVariable<Variable>(Type Ty); | 348 template <> Variable *Cfg::makeVariable<Variable>(Type Ty); |
347 | 349 |
348 struct NodeStringPoolTraits { | 350 struct NodeStringPoolTraits { |
349 using OwnerType = Cfg; | 351 using OwnerType = Cfg; |
350 static StringPool *getStrings(const OwnerType *PoolOwner) { | 352 static StringPool *getStrings(const OwnerType *PoolOwner) { |
351 return PoolOwner->getNodeStrings(); | 353 return PoolOwner->getNodeStrings(); |
352 } | 354 } |
353 }; | 355 }; |
354 using NodeString = StringID<NodeStringPoolTraits>; | 356 using NodeString = StringID<NodeStringPoolTraits>; |
355 | 357 |
356 struct VariableStringPoolTraits { | 358 struct VariableStringPoolTraits { |
357 using OwnerType = Cfg; | 359 using OwnerType = Cfg; |
358 static StringPool *getStrings(const OwnerType *PoolOwner) { | 360 static StringPool *getStrings(const OwnerType *PoolOwner) { |
359 return PoolOwner->getVarStrings(); | 361 return PoolOwner->getVarStrings(); |
360 } | 362 } |
361 }; | 363 }; |
362 using VariableString = StringID<VariableStringPoolTraits>; | 364 using VariableString = StringID<VariableStringPoolTraits>; |
363 | 365 |
364 } // end of namespace Ice | 366 } // end of namespace Ice |
365 | 367 |
366 #endif // SUBZERO_SRC_ICECFG_H | 368 #endif // SUBZERO_SRC_ICECFG_H |
OLD | NEW |