| 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 28 matching lines...) Expand all Loading... |
| 39 Live(nullptr), | 39 Live(nullptr), |
| 40 Target(TargetLowering::createLowering(Ctx->getTargetArch(), this)), | 40 Target(TargetLowering::createLowering(Ctx->getTargetArch(), this)), |
| 41 VMetadata(new VariablesMetadata(this)), | 41 VMetadata(new VariablesMetadata(this)), |
| 42 TargetAssembler( | 42 TargetAssembler( |
| 43 TargetLowering::createAssembler(Ctx->getTargetArch(), this)), | 43 TargetLowering::createAssembler(Ctx->getTargetArch(), this)), |
| 44 CurrentNode(nullptr) { | 44 CurrentNode(nullptr) { |
| 45 assert(!Ctx->isIRGenerationDisabled() && | 45 assert(!Ctx->isIRGenerationDisabled() && |
| 46 "Attempt to build cfg when IR generation disabled"); | 46 "Attempt to build cfg when IR generation disabled"); |
| 47 } | 47 } |
| 48 | 48 |
| 49 Cfg::~Cfg() { | 49 Cfg::~Cfg() { assert(ICE_TLS_GET_FIELD(CurrentCfg) == nullptr); } |
| 50 assert(ICE_TLS_GET_FIELD(CurrentCfg) == this); | |
| 51 // Reset the thread-local CurrentCfg pointer. | |
| 52 ICE_TLS_SET_FIELD(CurrentCfg, nullptr); | |
| 53 } | |
| 54 | 50 |
| 55 void Cfg::setError(const IceString &Message) { | 51 void Cfg::setError(const IceString &Message) { |
| 56 HasError = true; | 52 HasError = true; |
| 57 ErrorMessage = Message; | 53 ErrorMessage = Message; |
| 58 } | 54 } |
| 59 | 55 |
| 60 CfgNode *Cfg::makeNode() { | 56 CfgNode *Cfg::makeNode() { |
| 61 SizeT LabelIndex = Nodes.size(); | 57 SizeT LabelIndex = Nodes.size(); |
| 62 CfgNode *Node = CfgNode::create(this, LabelIndex); | 58 CfgNode *Node = CfgNode::create(this, LabelIndex); |
| 63 Nodes.push_back(Node); | 59 Nodes.push_back(Node); |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 } | 515 } |
| 520 } | 516 } |
| 521 // Print each basic block | 517 // Print each basic block |
| 522 for (CfgNode *Node : Nodes) | 518 for (CfgNode *Node : Nodes) |
| 523 Node->dump(this); | 519 Node->dump(this); |
| 524 if (isVerbose(IceV_Instructions)) | 520 if (isVerbose(IceV_Instructions)) |
| 525 Str << "}\n"; | 521 Str << "}\n"; |
| 526 } | 522 } |
| 527 | 523 |
| 528 } // end of namespace Ice | 524 } // end of namespace Ice |
| OLD | NEW |