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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 const VarList &getVariables() const { return Variables; } | 70 const VarList &getVariables() const { return Variables; } |
68 | 71 |
69 // Manage arguments to the function. | 72 // Manage arguments to the function. |
70 void addArg(Variable *Arg); | 73 void addArg(Variable *Arg); |
71 const VarList &getArgs() const { return Args; } | 74 const VarList &getArgs() const { return Args; } |
72 VarList &getArgs() { return Args; } | 75 VarList &getArgs() { return Args; } |
73 | 76 |
74 // Miscellaneous accessors. | 77 // Miscellaneous accessors. |
75 TargetLowering *getTarget() const { return Target.get(); } | 78 TargetLowering *getTarget() const { return Target.get(); } |
76 Liveness *getLiveness() const { return Live.get(); } | 79 Liveness *getLiveness() const { return Live.get(); } |
| 80 template <typename T> T *getAssembler() const { |
| 81 return static_cast<T *>(TargetAssembler.get()); |
| 82 } |
| 83 bool UseIntegratedAssembler() const { |
| 84 return getContext()->getFlags().UseIntegratedAssembler; |
| 85 } |
77 bool hasComputedFrame() const; | 86 bool hasComputedFrame() const; |
78 | 87 |
79 // Passes over the CFG. | 88 // Passes over the CFG. |
80 void translate(); | 89 void translate(); |
81 // After the CFG is fully constructed, iterate over the nodes and | 90 // After the CFG is fully constructed, iterate over the nodes and |
82 // compute the predecessor edges, in the form of | 91 // compute the predecessor edges, in the form of |
83 // CfgNode::InEdges[]. | 92 // CfgNode::InEdges[]. |
84 void computePredecessors(); | 93 void computePredecessors(); |
85 void renumberInstructions(); | 94 void renumberInstructions(); |
86 void placePhiLoads(); | 95 void placePhiLoads(); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 bool IsInternalLinkage; | 153 bool IsInternalLinkage; |
145 bool HasError; | 154 bool HasError; |
146 IceString ErrorMessage; | 155 IceString ErrorMessage; |
147 CfgNode *Entry; // entry basic block | 156 CfgNode *Entry; // entry basic block |
148 NodeList Nodes; // linearized node list; Entry should be first | 157 NodeList Nodes; // linearized node list; Entry should be first |
149 InstNumberT NextInstNumber; | 158 InstNumberT NextInstNumber; |
150 VarList Variables; | 159 VarList Variables; |
151 VarList Args; // subset of Variables, in argument order | 160 VarList Args; // subset of Variables, in argument order |
152 llvm::OwningPtr<Liveness> Live; | 161 llvm::OwningPtr<Liveness> Live; |
153 llvm::OwningPtr<TargetLowering> Target; | 162 llvm::OwningPtr<TargetLowering> Target; |
| 163 llvm::OwningPtr<Assembler> TargetAssembler; |
154 | 164 |
155 // CurrentNode is maintained during dumping/emitting just for | 165 // CurrentNode is maintained during dumping/emitting just for |
156 // validating Variable::DefNode. Normally, a traversal over | 166 // validating Variable::DefNode. Normally, a traversal over |
157 // CfgNodes maintains this, but before global operations like | 167 // CfgNodes maintains this, but before global operations like |
158 // register allocation, setCurrentNode(NULL) should be called to | 168 // register allocation, setCurrentNode(NULL) should be called to |
159 // avoid spurious validation failures. | 169 // avoid spurious validation failures. |
160 const CfgNode *CurrentNode; | 170 const CfgNode *CurrentNode; |
161 | 171 |
162 Cfg(const Cfg &) LLVM_DELETED_FUNCTION; | 172 Cfg(const Cfg &) LLVM_DELETED_FUNCTION; |
163 Cfg &operator=(const Cfg &) LLVM_DELETED_FUNCTION; | 173 Cfg &operator=(const Cfg &) LLVM_DELETED_FUNCTION; |
164 }; | 174 }; |
165 | 175 |
166 } // end of namespace Ice | 176 } // end of namespace Ice |
167 | 177 |
168 #endif // SUBZERO_SRC_ICECFG_H | 178 #endif // SUBZERO_SRC_ICECFG_H |
OLD | NEW |