| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 // to avoid embedding a std::string inside an arena-allocated | 88 // to avoid embedding a std::string inside an arena-allocated |
| 89 // object. | 89 // object. |
| 90 IdentifierIndexType addIdentifierName(const IceString &Name) { | 90 IdentifierIndexType addIdentifierName(const IceString &Name) { |
| 91 IdentifierIndexType Index = IdentifierNames.size(); | 91 IdentifierIndexType Index = IdentifierNames.size(); |
| 92 IdentifierNames.push_back(Name); | 92 IdentifierNames.push_back(Name); |
| 93 return Index; | 93 return Index; |
| 94 } | 94 } |
| 95 const IceString &getIdentifierName(IdentifierIndexType Index) const { | 95 const IceString &getIdentifierName(IdentifierIndexType Index) const { |
| 96 return IdentifierNames[Index]; | 96 return IdentifierNames[Index]; |
| 97 } | 97 } |
| 98 enum { | 98 enum { IdentifierIndexInvalid = -1 }; |
| 99 IdentifierIndexInvalid = -1 | |
| 100 }; | |
| 101 | 99 |
| 102 // Manage instruction numbering. | 100 // Manage instruction numbering. |
| 103 InstNumberT newInstNumber() { return NextInstNumber++; } | 101 InstNumberT newInstNumber() { return NextInstNumber++; } |
| 104 InstNumberT getNextInstNumber() const { return NextInstNumber; } | 102 InstNumberT getNextInstNumber() const { return NextInstNumber; } |
| 105 | 103 |
| 106 // Manage Variables. | 104 // Manage Variables. |
| 107 // Create a new Variable with a particular type and an optional | 105 // Create a new Variable with a particular type and an optional |
| 108 // name. The Node argument is the node where the variable is defined. | 106 // name. The Node argument is the node where the variable is defined. |
| 109 template <typename T = Variable> T *makeVariable(Type Ty) { | 107 template <typename T = Variable> T *makeVariable(Type Ty) { |
| 110 SizeT Index = Variables.size(); | 108 SizeT Index = Variables.size(); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 Type ReturnType; | 192 Type ReturnType; |
| 195 bool IsInternalLinkage; | 193 bool IsInternalLinkage; |
| 196 bool HasError; | 194 bool HasError; |
| 197 bool FocusedTiming; | 195 bool FocusedTiming; |
| 198 IceString ErrorMessage; | 196 IceString ErrorMessage; |
| 199 CfgNode *Entry; // entry basic block | 197 CfgNode *Entry; // entry basic block |
| 200 NodeList Nodes; // linearized node list; Entry should be first | 198 NodeList Nodes; // linearized node list; Entry should be first |
| 201 std::vector<IceString> IdentifierNames; | 199 std::vector<IceString> IdentifierNames; |
| 202 InstNumberT NextInstNumber; | 200 InstNumberT NextInstNumber; |
| 203 VarList Variables; | 201 VarList Variables; |
| 204 VarList Args; // subset of Variables, in argument order | 202 VarList Args; // subset of Variables, in argument order |
| 205 VarList ImplicitArgs; // subset of Variables | 203 VarList ImplicitArgs; // subset of Variables |
| 206 std::unique_ptr<ArenaAllocator<>> Allocator; | 204 std::unique_ptr<ArenaAllocator<>> Allocator; |
| 207 std::unique_ptr<Liveness> Live; | 205 std::unique_ptr<Liveness> Live; |
| 208 std::unique_ptr<TargetLowering> Target; | 206 std::unique_ptr<TargetLowering> Target; |
| 209 std::unique_ptr<VariablesMetadata> VMetadata; | 207 std::unique_ptr<VariablesMetadata> VMetadata; |
| 210 std::unique_ptr<Assembler> TargetAssembler; | 208 std::unique_ptr<Assembler> TargetAssembler; |
| 211 | 209 |
| 212 // CurrentNode is maintained during dumping/emitting just for | 210 // CurrentNode is maintained during dumping/emitting just for |
| 213 // validating Variable::DefNode. Normally, a traversal over | 211 // validating Variable::DefNode. Normally, a traversal over |
| 214 // CfgNodes maintains this, but before global operations like | 212 // CfgNodes maintains this, but before global operations like |
| 215 // register allocation, resetCurrentNode() should be called to avoid | 213 // register allocation, resetCurrentNode() should be called to avoid |
| 216 // spurious validation failures. | 214 // spurious validation failures. |
| 217 const CfgNode *CurrentNode; | 215 const CfgNode *CurrentNode; |
| 218 | 216 |
| 219 // Maintain a pointer in TLS to the current Cfg being translated. | 217 // Maintain a pointer in TLS to the current Cfg being translated. |
| 220 // This is primarily for accessing its allocator statelessly, but | 218 // This is primarily for accessing its allocator statelessly, but |
| 221 // other uses are possible. | 219 // other uses are possible. |
| 222 ICE_TLS_DECLARE_FIELD(const Cfg *, CurrentCfg); | 220 ICE_TLS_DECLARE_FIELD(const Cfg *, CurrentCfg); |
| 223 | 221 |
| 224 public: | 222 public: |
| 225 static void TlsInit() { ICE_TLS_INIT_FIELD(CurrentCfg); } | 223 static void TlsInit() { ICE_TLS_INIT_FIELD(CurrentCfg); } |
| 226 }; | 224 }; |
| 227 | 225 |
| 228 } // end of namespace Ice | 226 } // end of namespace Ice |
| 229 | 227 |
| 230 #endif // SUBZERO_SRC_ICECFG_H | 228 #endif // SUBZERO_SRC_ICECFG_H |
| OLD | NEW |