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 // This file declares the Cfg class, which represents the control flow | 10 // This file declares the Cfg class, which represents the control flow |
(...skipping 25 matching lines...) Expand all Loading... |
36 // it through the callers, to make ownership and lifetime and | 36 // it through the callers, to make ownership and lifetime and |
37 // destruction requirements more explicit. | 37 // destruction requirements more explicit. |
38 static Cfg *create(GlobalContext *Ctx) { | 38 static Cfg *create(GlobalContext *Ctx) { |
39 Cfg *Func = new Cfg(Ctx); | 39 Cfg *Func = new Cfg(Ctx); |
40 CurrentCfg = Func; | 40 CurrentCfg = Func; |
41 return Func; | 41 return Func; |
42 } | 42 } |
43 // Gets a pointer to the current thread's Cfg. | 43 // Gets a pointer to the current thread's Cfg. |
44 static const Cfg *getCurrentCfg() { return CurrentCfg; } | 44 static const Cfg *getCurrentCfg() { return CurrentCfg; } |
45 // Gets a pointer to the current thread's Cfg's allocator. | 45 // Gets a pointer to the current thread's Cfg's allocator. |
46 static ArenaAllocator *getCurrentCfgAllocator() { | 46 static ArenaAllocator<> *getCurrentCfgAllocator() { |
47 assert(CurrentCfg); | 47 assert(CurrentCfg); |
48 return CurrentCfg->Allocator.get(); | 48 return CurrentCfg->Allocator.get(); |
49 } | 49 } |
50 | 50 |
51 GlobalContext *getContext() const { return Ctx; } | 51 GlobalContext *getContext() const { return Ctx; } |
52 | 52 |
53 // Manage the name and return type of the function being translated. | 53 // Manage the name and return type of the function being translated. |
54 void setFunctionName(const IceString &Name) { FunctionName = Name; } | 54 void setFunctionName(const IceString &Name) { FunctionName = Name; } |
55 IceString getFunctionName() const { return FunctionName; } | 55 IceString getFunctionName() const { return FunctionName; } |
56 void setReturnType(Type Ty) { ReturnType = Ty; } | 56 void setReturnType(Type Ty) { ReturnType = Ty; } |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 bool HasError; | 190 bool HasError; |
191 bool FocusedTiming; | 191 bool FocusedTiming; |
192 IceString ErrorMessage; | 192 IceString ErrorMessage; |
193 CfgNode *Entry; // entry basic block | 193 CfgNode *Entry; // entry basic block |
194 NodeList Nodes; // linearized node list; Entry should be first | 194 NodeList Nodes; // linearized node list; Entry should be first |
195 std::vector<IceString> IdentifierNames; | 195 std::vector<IceString> IdentifierNames; |
196 InstNumberT NextInstNumber; | 196 InstNumberT NextInstNumber; |
197 VarList Variables; | 197 VarList Variables; |
198 VarList Args; // subset of Variables, in argument order | 198 VarList Args; // subset of Variables, in argument order |
199 VarList ImplicitArgs; // subset of Variables | 199 VarList ImplicitArgs; // subset of Variables |
200 std::unique_ptr<ArenaAllocator> Allocator; | 200 std::unique_ptr<ArenaAllocator<>> Allocator; |
201 std::unique_ptr<Liveness> Live; | 201 std::unique_ptr<Liveness> Live; |
202 std::unique_ptr<TargetLowering> Target; | 202 std::unique_ptr<TargetLowering> Target; |
203 std::unique_ptr<VariablesMetadata> VMetadata; | 203 std::unique_ptr<VariablesMetadata> VMetadata; |
204 std::unique_ptr<Assembler> TargetAssembler; | 204 std::unique_ptr<Assembler> TargetAssembler; |
205 | 205 |
206 // CurrentNode is maintained during dumping/emitting just for | 206 // CurrentNode is maintained during dumping/emitting just for |
207 // validating Variable::DefNode. Normally, a traversal over | 207 // validating Variable::DefNode. Normally, a traversal over |
208 // CfgNodes maintains this, but before global operations like | 208 // CfgNodes maintains this, but before global operations like |
209 // register allocation, resetCurrentNode() should be called to avoid | 209 // register allocation, resetCurrentNode() should be called to avoid |
210 // spurious validation failures. | 210 // spurious validation failures. |
211 const CfgNode *CurrentNode; | 211 const CfgNode *CurrentNode; |
212 | 212 |
213 // Maintain a pointer in TLS to the current Cfg being translated. | 213 // Maintain a pointer in TLS to the current Cfg being translated. |
214 // This is primarily for accessing its allocator statelessly, but | 214 // This is primarily for accessing its allocator statelessly, but |
215 // other uses are possible. | 215 // other uses are possible. |
216 thread_local static const Cfg *CurrentCfg; | 216 thread_local static const Cfg *CurrentCfg; |
217 }; | 217 }; |
218 | 218 |
219 } // end of namespace Ice | 219 } // end of namespace Ice |
220 | 220 |
221 #endif // SUBZERO_SRC_ICECFG_H | 221 #endif // SUBZERO_SRC_ICECFG_H |
OLD | NEW |