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 |
11 // graph and the overall per-function compilation context. | 11 // graph and the overall per-function compilation context. |
12 // | 12 // |
13 //===----------------------------------------------------------------------===// | 13 //===----------------------------------------------------------------------===// |
14 | 14 |
15 #ifndef SUBZERO_SRC_ICECFG_H | 15 #ifndef SUBZERO_SRC_ICECFG_H |
16 #define SUBZERO_SRC_ICECFG_H | 16 #define SUBZERO_SRC_ICECFG_H |
17 | 17 |
18 #include "IceDefs.h" | 18 #include "IceDefs.h" |
19 #include "IceTypes.h" | 19 #include "IceTypes.h" |
| 20 |
| 21 #include "assembler.h" |
| 22 #include "IceClFlags.h" |
20 #include "IceGlobalContext.h" | 23 #include "IceGlobalContext.h" |
21 | 24 |
22 #include "llvm/ADT/OwningPtr.h" | 25 #include "llvm/ADT/OwningPtr.h" |
23 #include "llvm/Support/Allocator.h" | 26 #include "llvm/Support/Allocator.h" |
24 | 27 |
25 namespace Ice { | 28 namespace Ice { |
26 | 29 |
27 class Cfg { | 30 class Cfg { |
28 public: | 31 public: |
29 Cfg(GlobalContext *Ctx); | 32 Cfg(GlobalContext *Ctx); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 void addArg(Variable *Arg); | 82 void addArg(Variable *Arg); |
80 const VarList &getArgs() const { return Args; } | 83 const VarList &getArgs() const { return Args; } |
81 VarList &getArgs() { return Args; } | 84 VarList &getArgs() { return Args; } |
82 void addImplicitArg(Variable *Arg); | 85 void addImplicitArg(Variable *Arg); |
83 const VarList &getImplicitArgs() const { return ImplicitArgs; } | 86 const VarList &getImplicitArgs() const { return ImplicitArgs; } |
84 | 87 |
85 // Miscellaneous accessors. | 88 // Miscellaneous accessors. |
86 TargetLowering *getTarget() const { return Target.get(); } | 89 TargetLowering *getTarget() const { return Target.get(); } |
87 VariablesMetadata *getVMetadata() const { return VMetadata.get(); } | 90 VariablesMetadata *getVMetadata() const { return VMetadata.get(); } |
88 Liveness *getLiveness() const { return Live.get(); } | 91 Liveness *getLiveness() const { return Live.get(); } |
| 92 template <typename T> T *getAssembler() const { |
| 93 return static_cast<T *>(TargetAssembler.get()); |
| 94 } |
| 95 bool UseIntegratedAssembler() const { |
| 96 return getContext()->getFlags().UseIntegratedAssembler; |
| 97 } |
89 bool hasComputedFrame() const; | 98 bool hasComputedFrame() const; |
90 | 99 |
91 // Passes over the CFG. | 100 // Passes over the CFG. |
92 void translate(); | 101 void translate(); |
93 // After the CFG is fully constructed, iterate over the nodes and | 102 // After the CFG is fully constructed, iterate over the nodes and |
94 // compute the predecessor edges, in the form of | 103 // compute the predecessor edges, in the form of |
95 // CfgNode::InEdges[]. | 104 // CfgNode::InEdges[]. |
96 void computePredecessors(); | 105 void computePredecessors(); |
97 void renumberInstructions(); | 106 void renumberInstructions(); |
98 void placePhiLoads(); | 107 void placePhiLoads(); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 IceString ErrorMessage; | 168 IceString ErrorMessage; |
160 CfgNode *Entry; // entry basic block | 169 CfgNode *Entry; // entry basic block |
161 NodeList Nodes; // linearized node list; Entry should be first | 170 NodeList Nodes; // linearized node list; Entry should be first |
162 InstNumberT NextInstNumber; | 171 InstNumberT NextInstNumber; |
163 VarList Variables; | 172 VarList Variables; |
164 VarList Args; // subset of Variables, in argument order | 173 VarList Args; // subset of Variables, in argument order |
165 VarList ImplicitArgs; // subset of Variables | 174 VarList ImplicitArgs; // subset of Variables |
166 llvm::OwningPtr<Liveness> Live; | 175 llvm::OwningPtr<Liveness> Live; |
167 llvm::OwningPtr<TargetLowering> Target; | 176 llvm::OwningPtr<TargetLowering> Target; |
168 llvm::OwningPtr<VariablesMetadata> VMetadata; | 177 llvm::OwningPtr<VariablesMetadata> VMetadata; |
| 178 llvm::OwningPtr<Assembler> TargetAssembler; |
169 | 179 |
170 // CurrentNode is maintained during dumping/emitting just for | 180 // CurrentNode is maintained during dumping/emitting just for |
171 // validating Variable::DefNode. Normally, a traversal over | 181 // validating Variable::DefNode. Normally, a traversal over |
172 // CfgNodes maintains this, but before global operations like | 182 // CfgNodes maintains this, but before global operations like |
173 // register allocation, resetCurrentNode() should be called to avoid | 183 // register allocation, resetCurrentNode() should be called to avoid |
174 // spurious validation failures. | 184 // spurious validation failures. |
175 const CfgNode *CurrentNode; | 185 const CfgNode *CurrentNode; |
176 | 186 |
177 Cfg(const Cfg &) LLVM_DELETED_FUNCTION; | 187 Cfg(const Cfg &) LLVM_DELETED_FUNCTION; |
178 Cfg &operator=(const Cfg &) LLVM_DELETED_FUNCTION; | 188 Cfg &operator=(const Cfg &) LLVM_DELETED_FUNCTION; |
179 }; | 189 }; |
180 | 190 |
181 } // end of namespace Ice | 191 } // end of namespace Ice |
182 | 192 |
183 #endif // SUBZERO_SRC_ICECFG_H | 193 #endif // SUBZERO_SRC_ICECFG_H |
OLD | NEW |