| 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 // This file implements the Cfg class, including constant pool | 10 // This file implements the Cfg class, including constant pool |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 Ctx->getStrDump() << "ICE translation error: " << ErrorMessage << "\n"; | 38 Ctx->getStrDump() << "ICE translation error: " << ErrorMessage << "\n"; |
| 39 } | 39 } |
| 40 | 40 |
| 41 CfgNode *Cfg::makeNode(const IceString &Name) { | 41 CfgNode *Cfg::makeNode(const IceString &Name) { |
| 42 SizeT LabelIndex = Nodes.size(); | 42 SizeT LabelIndex = Nodes.size(); |
| 43 CfgNode *Node = CfgNode::create(this, LabelIndex, Name); | 43 CfgNode *Node = CfgNode::create(this, LabelIndex, Name); |
| 44 Nodes.push_back(Node); | 44 Nodes.push_back(Node); |
| 45 return Node; | 45 return Node; |
| 46 } | 46 } |
| 47 | 47 |
| 48 // Create a new Variable with a particular type and an optional | |
| 49 // name. The Node argument is the node where the variable is defined. | |
| 50 Variable *Cfg::makeVariable(Type Ty, const CfgNode *Node, | 48 Variable *Cfg::makeVariable(Type Ty, const CfgNode *Node, |
| 51 const IceString &Name) { | 49 const IceString &Name) { |
| 52 SizeT Index = Variables.size(); | 50 return makeVariable<Variable>(Ty, Node, Name); |
| 53 Variables.push_back(Variable::create(this, Ty, Node, Index, Name)); | |
| 54 return Variables[Index]; | |
| 55 } | 51 } |
| 56 | 52 |
| 57 void Cfg::addArg(Variable *Arg) { | 53 void Cfg::addArg(Variable *Arg) { |
| 58 Arg->setIsArg(this); | 54 Arg->setIsArg(this); |
| 59 Args.push_back(Arg); | 55 Args.push_back(Arg); |
| 60 } | 56 } |
| 61 | 57 |
| 62 // Returns whether the stack frame layout has been computed yet. This | 58 // Returns whether the stack frame layout has been computed yet. This |
| 63 // is used for dumping the stack frame location of Variables. | 59 // is used for dumping the stack frame location of Variables. |
| 64 bool Cfg::hasComputedFrame() const { return getTarget()->hasComputedFrame(); } | 60 bool Cfg::hasComputedFrame() const { return getTarget()->hasComputedFrame(); } |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 Str << "internal "; | 348 Str << "internal "; |
| 353 Str << ReturnType << " @" << getFunctionName() << "("; | 349 Str << ReturnType << " @" << getFunctionName() << "("; |
| 354 for (SizeT i = 0; i < Args.size(); ++i) { | 350 for (SizeT i = 0; i < Args.size(); ++i) { |
| 355 if (i > 0) | 351 if (i > 0) |
| 356 Str << ", "; | 352 Str << ", "; |
| 357 Str << Args[i]->getType() << " "; | 353 Str << Args[i]->getType() << " "; |
| 358 Args[i]->dump(this); | 354 Args[i]->dump(this); |
| 359 } | 355 } |
| 360 Str << ") {\n"; | 356 Str << ") {\n"; |
| 361 } | 357 } |
| 362 setCurrentNode(NULL); | 358 resetCurrentNode(); |
| 363 if (getContext()->isVerbose(IceV_Liveness)) { | 359 if (getContext()->isVerbose(IceV_Liveness)) { |
| 364 // Print summary info about variables | 360 // Print summary info about variables |
| 365 for (VarList::const_iterator I = Variables.begin(), E = Variables.end(); | 361 for (VarList::const_iterator I = Variables.begin(), E = Variables.end(); |
| 366 I != E; ++I) { | 362 I != E; ++I) { |
| 367 Variable *Var = *I; | 363 Variable *Var = *I; |
| 368 Str << "//" | 364 Str << "//" |
| 369 << " multiblock=" << Var->isMultiblockLife() << " " | 365 << " multiblock=" << Var->isMultiblockLife() << " " |
| 370 << " weight=" << Var->getWeight() << " "; | 366 << " weight=" << Var->getWeight() << " "; |
| 371 Var->dump(this); | 367 Var->dump(this); |
| 372 if (Variable *Pref = Var->getPreferredRegister()) { | 368 if (Variable *Pref = Var->getPreferredRegister()) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 383 for (NodeList::const_iterator I = Nodes.begin(), E = Nodes.end(); I != E; | 379 for (NodeList::const_iterator I = Nodes.begin(), E = Nodes.end(); I != E; |
| 384 ++I) { | 380 ++I) { |
| 385 (*I)->dump(this); | 381 (*I)->dump(this); |
| 386 } | 382 } |
| 387 if (getContext()->isVerbose(IceV_Instructions)) { | 383 if (getContext()->isVerbose(IceV_Instructions)) { |
| 388 Str << "}\n"; | 384 Str << "}\n"; |
| 389 } | 385 } |
| 390 } | 386 } |
| 391 | 387 |
| 392 } // end of namespace Ice | 388 } // end of namespace Ice |
| OLD | NEW |