| OLD | NEW |
| 1 //===- subzero/src/IceCfg.cpp - Control flow graph implementation ---------===// | 1 //===- subzero/src/IceCfg.cpp - Control flow graph implementation ---------===// |
| 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 | 112 |
| 113 void Cfg::swapNodes(NodeList &NewNodes) { | 113 void Cfg::swapNodes(NodeList &NewNodes) { |
| 114 assert(Nodes.size() == NewNodes.size()); | 114 assert(Nodes.size() == NewNodes.size()); |
| 115 Nodes.swap(NewNodes); | 115 Nodes.swap(NewNodes); |
| 116 for (SizeT I = 0, NumNodes = getNumNodes(); I < NumNodes; ++I) | 116 for (SizeT I = 0, NumNodes = getNumNodes(); I < NumNodes; ++I) |
| 117 Nodes[I]->resetIndex(I); | 117 Nodes[I]->resetIndex(I); |
| 118 } | 118 } |
| 119 | 119 |
| 120 template <> Variable *Cfg::makeVariable<Variable>(Type Ty) { | 120 template <> Variable *Cfg::makeVariable<Variable>(Type Ty) { |
| 121 SizeT Index = Variables.size(); | 121 SizeT Index = Variables.size(); |
| 122 Variable *Var = Target->shouldSplitToVariable64On32(Ty) | 122 Variable *Var; |
| 123 ? Variable64On32::create(this, Ty, Index) | 123 if (Target->shouldSplitToVariableVecOn32(Ty)) { |
| 124 : Variable::create(this, Ty, Index); | 124 Var = VariableVecOn32::create(this, Ty, Index); |
| 125 } else if (Target->shouldSplitToVariable64On32(Ty)) { |
| 126 Var = Variable64On32::create(this, Ty, Index); |
| 127 } else { |
| 128 Var = Variable::create(this, Ty, Index); |
| 129 } |
| 125 Variables.push_back(Var); | 130 Variables.push_back(Var); |
| 126 return Var; | 131 return Var; |
| 127 } | 132 } |
| 128 | 133 |
| 129 void Cfg::addArg(Variable *Arg) { | 134 void Cfg::addArg(Variable *Arg) { |
| 130 Arg->setIsArg(); | 135 Arg->setIsArg(); |
| 131 Args.push_back(Arg); | 136 Args.push_back(Arg); |
| 132 } | 137 } |
| 133 | 138 |
| 134 void Cfg::addImplicitArg(Variable *Arg) { | 139 void Cfg::addImplicitArg(Variable *Arg) { |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 profileBlocks(); | 242 profileBlocks(); |
| 238 // TODO(jpp): this is fragile, at best. Figure out a better way of | 243 // TODO(jpp): this is fragile, at best. Figure out a better way of |
| 239 // detecting exit functions. | 244 // detecting exit functions. |
| 240 if (getFunctionName().toStringOrEmpty() == "exit") { | 245 if (getFunctionName().toStringOrEmpty() == "exit") { |
| 241 addCallToProfileSummary(); | 246 addCallToProfileSummary(); |
| 242 } | 247 } |
| 243 dump("Profiled CFG"); | 248 dump("Profiled CFG"); |
| 244 } | 249 } |
| 245 | 250 |
| 246 // Create the Hi and Lo variables where a split was needed | 251 // Create the Hi and Lo variables where a split was needed |
| 247 for (Variable *Var : Variables) | 252 for (Variable *Var : Variables) { |
| 248 if (auto *Var64On32 = llvm::dyn_cast<Variable64On32>(Var)) | 253 if (auto *Var64On32 = llvm::dyn_cast<Variable64On32>(Var)) { |
| 249 Var64On32->initHiLo(this); | 254 Var64On32->initHiLo(this); |
| 255 } else if (auto *VarVecOn32 = llvm::dyn_cast<VariableVecOn32>(Var)) { |
| 256 VarVecOn32->initVecElement(this); |
| 257 } |
| 258 } |
| 250 | 259 |
| 251 // Instrument the Cfg, e.g. with AddressSanitizer | 260 // Instrument the Cfg, e.g. with AddressSanitizer |
| 252 if (!BuildDefs::minimal() && getFlags().getSanitizeAddresses()) { | 261 if (!BuildDefs::minimal() && getFlags().getSanitizeAddresses()) { |
| 253 getContext()->instrumentFunc(this); | 262 getContext()->instrumentFunc(this); |
| 254 dump("Instrumented CFG"); | 263 dump("Instrumented CFG"); |
| 255 } | 264 } |
| 256 | 265 |
| 257 // The set of translation passes and their order are determined by the | 266 // The set of translation passes and their order are determined by the |
| 258 // target. | 267 // target. |
| 259 getTarget()->translate(); | 268 getTarget()->translate(); |
| (...skipping 1610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1870 } | 1879 } |
| 1871 } | 1880 } |
| 1872 // Print each basic block | 1881 // Print each basic block |
| 1873 for (CfgNode *Node : Nodes) | 1882 for (CfgNode *Node : Nodes) |
| 1874 Node->dump(this); | 1883 Node->dump(this); |
| 1875 if (isVerbose(IceV_Instructions)) | 1884 if (isVerbose(IceV_Instructions)) |
| 1876 Str << "}\n"; | 1885 Str << "}\n"; |
| 1877 } | 1886 } |
| 1878 | 1887 |
| 1879 } // end of namespace Ice | 1888 } // end of namespace Ice |
| OLD | NEW |