| 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 |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 | 133 |
| 134 /// \name Manage arguments to the function. | 134 /// \name Manage arguments to the function. |
| 135 /// @{ | 135 /// @{ |
| 136 void addArg(Variable *Arg); | 136 void addArg(Variable *Arg); |
| 137 const VarList &getArgs() const { return Args; } | 137 const VarList &getArgs() const { return Args; } |
| 138 VarList &getArgs() { return Args; } | 138 VarList &getArgs() { return Args; } |
| 139 void addImplicitArg(Variable *Arg); | 139 void addImplicitArg(Variable *Arg); |
| 140 const VarList &getImplicitArgs() const { return ImplicitArgs; } | 140 const VarList &getImplicitArgs() const { return ImplicitArgs; } |
| 141 /// @} | 141 /// @} |
| 142 | 142 |
| 143 /// \name Manage the jump tables. |
| 144 /// @{ |
| 145 void addJumpTable(InstJumpTable *JumpTable) { |
| 146 JumpTables.emplace_back(JumpTable); |
| 147 } |
| 148 /// @} |
| 149 |
| 143 /// \name Miscellaneous accessors. | 150 /// \name Miscellaneous accessors. |
| 144 /// @{ | 151 /// @{ |
| 145 TargetLowering *getTarget() const { return Target.get(); } | 152 TargetLowering *getTarget() const { return Target.get(); } |
| 146 VariablesMetadata *getVMetadata() const { return VMetadata.get(); } | 153 VariablesMetadata *getVMetadata() const { return VMetadata.get(); } |
| 147 Liveness *getLiveness() const { return Live.get(); } | 154 Liveness *getLiveness() const { return Live.get(); } |
| 148 template <typename T = Assembler> T *getAssembler() const { | 155 template <typename T = Assembler> T *getAssembler() const { |
| 149 return llvm::dyn_cast<T>(TargetAssembler.get()); | 156 return llvm::dyn_cast<T>(TargetAssembler.get()); |
| 150 } | 157 } |
| 151 Assembler *releaseAssembler() { return TargetAssembler.release(); } | 158 Assembler *releaseAssembler() { return TargetAssembler.release(); } |
| 152 std::unique_ptr<VariableDeclarationList> getGlobalInits() { | 159 std::unique_ptr<VariableDeclarationList> getGlobalInits() { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 176 void doAddressOpt(); | 183 void doAddressOpt(); |
| 177 void doArgLowering(); | 184 void doArgLowering(); |
| 178 void doNopInsertion(); | 185 void doNopInsertion(); |
| 179 void genCode(); | 186 void genCode(); |
| 180 void genFrame(); | 187 void genFrame(); |
| 181 void livenessLightweight(); | 188 void livenessLightweight(); |
| 182 void liveness(LivenessMode Mode); | 189 void liveness(LivenessMode Mode); |
| 183 bool validateLiveness() const; | 190 bool validateLiveness() const; |
| 184 void contractEmptyNodes(); | 191 void contractEmptyNodes(); |
| 185 void doBranchOpt(); | 192 void doBranchOpt(); |
| 193 void markNodesForSandboxing(); |
| 186 | 194 |
| 187 /// \name Manage the CurrentNode field. | 195 /// \name Manage the CurrentNode field. |
| 188 /// CurrentNode is used for validating the Variable::DefNode field during | 196 /// CurrentNode is used for validating the Variable::DefNode field during |
| 189 /// dumping/emitting. | 197 /// dumping/emitting. |
| 190 /// @{ | 198 /// @{ |
| 191 void setCurrentNode(const CfgNode *Node) { CurrentNode = Node; } | 199 void setCurrentNode(const CfgNode *Node) { CurrentNode = Node; } |
| 192 void resetCurrentNode() { setCurrentNode(nullptr); } | 200 void resetCurrentNode() { setCurrentNode(nullptr); } |
| 193 const CfgNode *getCurrentNode() const { return CurrentNode; } | 201 const CfgNode *getCurrentNode() const { return CurrentNode; } |
| 194 /// @} | 202 /// @} |
| 195 | 203 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 222 | 230 |
| 223 /// Adds a call to the ProfileSummary runtime function as the first | 231 /// Adds a call to the ProfileSummary runtime function as the first |
| 224 /// instruction in this CFG's entry block. | 232 /// instruction in this CFG's entry block. |
| 225 void addCallToProfileSummary(); | 233 void addCallToProfileSummary(); |
| 226 | 234 |
| 227 /// Iterates over the basic blocks in this CFG, adding profiling code to each | 235 /// Iterates over the basic blocks in this CFG, adding profiling code to each |
| 228 /// one of them. It returns a list with all the globals that the profiling | 236 /// one of them. It returns a list with all the globals that the profiling |
| 229 /// code needs to be defined. | 237 /// code needs to be defined. |
| 230 void profileBlocks(); | 238 void profileBlocks(); |
| 231 | 239 |
| 240 /// Delete registered jump table placeholder instructions. This should only be |
| 241 /// called once all repointing has taken place. |
| 242 void deleteJumpTableInsts(); |
| 243 /// Iterate through the registered jump tables and emit them. |
| 244 void emitJumpTables(); |
| 245 |
| 232 GlobalContext *Ctx; | 246 GlobalContext *Ctx; |
| 233 uint32_t SequenceNumber; /// output order for emission | 247 uint32_t SequenceNumber; /// output order for emission |
| 234 VerboseMask VMask; | 248 VerboseMask VMask; |
| 235 IceString FunctionName = ""; | 249 IceString FunctionName = ""; |
| 236 Type ReturnType = IceType_void; | 250 Type ReturnType = IceType_void; |
| 237 bool IsInternalLinkage = false; | 251 bool IsInternalLinkage = false; |
| 238 bool HasError = false; | 252 bool HasError = false; |
| 239 bool FocusedTiming = false; | 253 bool FocusedTiming = false; |
| 240 IceString ErrorMessage = ""; | 254 IceString ErrorMessage = ""; |
| 241 CfgNode *Entry = nullptr; /// entry basic block | 255 CfgNode *Entry = nullptr; /// entry basic block |
| 242 NodeList Nodes; /// linearized node list; Entry should be first | 256 NodeList Nodes; /// linearized node list; Entry should be first |
| 243 std::vector<IceString> IdentifierNames; | 257 std::vector<IceString> IdentifierNames; |
| 244 InstNumberT NextInstNumber; | 258 InstNumberT NextInstNumber; |
| 245 VarList Variables; | 259 VarList Variables; |
| 246 VarList Args; /// subset of Variables, in argument order | 260 VarList Args; /// subset of Variables, in argument order |
| 247 VarList ImplicitArgs; /// subset of Variables | 261 VarList ImplicitArgs; /// subset of Variables |
| 248 std::unique_ptr<ArenaAllocator<>> Allocator; | 262 std::unique_ptr<ArenaAllocator<>> Allocator; |
| 249 std::unique_ptr<Liveness> Live; | 263 std::unique_ptr<Liveness> Live; |
| 250 std::unique_ptr<TargetLowering> Target; | 264 std::unique_ptr<TargetLowering> Target; |
| 251 std::unique_ptr<VariablesMetadata> VMetadata; | 265 std::unique_ptr<VariablesMetadata> VMetadata; |
| 252 std::unique_ptr<Assembler> TargetAssembler; | 266 std::unique_ptr<Assembler> TargetAssembler; |
| 253 /// Globals required by this CFG. Mostly used for the profiler's globals. | 267 /// Globals required by this CFG. Mostly used for the profiler's globals. |
| 254 std::unique_ptr<VariableDeclarationList> GlobalInits; | 268 std::unique_ptr<VariableDeclarationList> GlobalInits; |
| 269 std::vector<InstJumpTable *> JumpTables; |
| 255 | 270 |
| 256 /// CurrentNode is maintained during dumping/emitting just for | 271 /// CurrentNode is maintained during dumping/emitting just for |
| 257 /// validating Variable::DefNode. Normally, a traversal over | 272 /// validating Variable::DefNode. Normally, a traversal over |
| 258 /// CfgNodes maintains this, but before global operations like | 273 /// CfgNodes maintains this, but before global operations like |
| 259 /// register allocation, resetCurrentNode() should be called to avoid | 274 /// register allocation, resetCurrentNode() should be called to avoid |
| 260 /// spurious validation failures. | 275 /// spurious validation failures. |
| 261 const CfgNode *CurrentNode = nullptr; | 276 const CfgNode *CurrentNode = nullptr; |
| 262 | 277 |
| 263 /// Maintain a pointer in TLS to the current Cfg being translated. | 278 /// Maintain a pointer in TLS to the current Cfg being translated. |
| 264 /// This is primarily for accessing its allocator statelessly, but | 279 /// This is primarily for accessing its allocator statelessly, but |
| 265 /// other uses are possible. | 280 /// other uses are possible. |
| 266 ICE_TLS_DECLARE_FIELD(const Cfg *, CurrentCfg); | 281 ICE_TLS_DECLARE_FIELD(const Cfg *, CurrentCfg); |
| 267 | 282 |
| 268 public: | 283 public: |
| 269 static void TlsInit() { ICE_TLS_INIT_FIELD(CurrentCfg); } | 284 static void TlsInit() { ICE_TLS_INIT_FIELD(CurrentCfg); } |
| 270 }; | 285 }; |
| 271 | 286 |
| 272 } // end of namespace Ice | 287 } // end of namespace Ice |
| 273 | 288 |
| 274 #endif // SUBZERO_SRC_ICECFG_H | 289 #endif // SUBZERO_SRC_ICECFG_H |
| OLD | NEW |