OLD | NEW |
1 //===- subzero/src/IceCfgNode.cpp - Basic block (node) implementation -----===// | 1 //===- subzero/src/IceCfgNode.cpp - Basic block (node) 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 |
11 /// This file implements the CfgNode class, including the complexities | 11 /// This file implements the CfgNode class, including the complexities |
12 /// of instruction insertion and in-edge calculation. | 12 /// of instruction insertion and in-edge calculation. |
13 /// | 13 /// |
14 //===----------------------------------------------------------------------===// | 14 //===----------------------------------------------------------------------===// |
15 | 15 |
16 #include "IceCfgNode.h" | 16 #include "IceCfgNode.h" |
17 | 17 |
18 #include "IceAssembler.h" | 18 #include "IceAssembler.h" |
19 #include "IceCfg.h" | 19 #include "IceCfg.h" |
20 #include "IceGlobalInits.h" | 20 #include "IceGlobalInits.h" |
21 #include "IceInst.h" | 21 #include "IceInst.h" |
22 #include "IceInstVarIter.h" | 22 #include "IceInstVarIter.h" |
23 #include "IceLiveness.h" | 23 #include "IceLiveness.h" |
24 #include "IceOperand.h" | 24 #include "IceOperand.h" |
25 #include "IceTargetLowering.h" | 25 #include "IceTargetLowering.h" |
26 | 26 |
27 namespace Ice { | 27 namespace Ice { |
28 | 28 |
29 CfgNode::CfgNode(Cfg *Func, SizeT LabelNumber) | 29 CfgNode::CfgNode(Cfg *Func, SizeT LabelNumber) |
30 : Func(Func), Number(LabelNumber) {} | 30 : Func(Func), Number(LabelNumber), LabelNumber(LabelNumber) {} |
31 | 31 |
32 // Returns the name the node was created with. If no name was given, | 32 // Returns the name the node was created with. If no name was given, |
33 // it synthesizes a (hopefully) unique name. | 33 // it synthesizes a (hopefully) unique name. |
34 IceString CfgNode::getName() const { | 34 IceString CfgNode::getName() const { |
35 if (NameIndex >= 0) | 35 if (NameIndex >= 0) |
36 return Func->getIdentifierName(NameIndex); | 36 return Func->getIdentifierName(NameIndex); |
37 return "__" + std::to_string(getIndex()); | 37 return "__" + std::to_string(LabelNumber); |
38 } | 38 } |
39 | 39 |
40 // Adds an instruction to either the Phi list or the regular | 40 // Adds an instruction to either the Phi list or the regular |
41 // instruction list. Validates that all Phis are added before all | 41 // instruction list. Validates that all Phis are added before all |
42 // regular instructions. | 42 // regular instructions. |
43 void CfgNode::appendInst(Inst *Inst) { | 43 void CfgNode::appendInst(Inst *Inst) { |
44 ++InstCountEstimate; | 44 ++InstCountEstimate; |
45 if (InstPhi *Phi = llvm::dyn_cast<InstPhi>(Inst)) { | 45 if (InstPhi *Phi = llvm::dyn_cast<InstPhi>(Inst)) { |
46 if (!Insts.empty()) { | 46 if (!Insts.empty()) { |
47 Func->setError("Phi instruction added to the middle of a block"); | 47 Func->setError("Phi instruction added to the middle of a block"); |
(...skipping 1235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1283 InstIntrinsicCall *Inst = InstIntrinsicCall::create( | 1283 InstIntrinsicCall *Inst = InstIntrinsicCall::create( |
1284 Func, 5, Func->makeVariable(IceType_i64), RMWI64Name, Info->Info); | 1284 Func, 5, Func->makeVariable(IceType_i64), RMWI64Name, Info->Info); |
1285 Inst->addArg(AtomicRMWOp); | 1285 Inst->addArg(AtomicRMWOp); |
1286 Inst->addArg(Counter); | 1286 Inst->addArg(Counter); |
1287 Inst->addArg(One); | 1287 Inst->addArg(One); |
1288 Inst->addArg(OrderAcquireRelease); | 1288 Inst->addArg(OrderAcquireRelease); |
1289 Insts.push_front(Inst); | 1289 Insts.push_front(Inst); |
1290 } | 1290 } |
1291 | 1291 |
1292 } // end of namespace Ice | 1292 } // end of namespace Ice |
OLD | NEW |