| 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 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 } | 46 } |
| 47 Phis.push_back(Phi); | 47 Phis.push_back(Phi); |
| 48 } else { | 48 } else { |
| 49 Insts.push_back(Instr); | 49 Insts.push_back(Instr); |
| 50 } | 50 } |
| 51 } | 51 } |
| 52 | 52 |
| 53 namespace { | 53 namespace { |
| 54 template <typename List> void removeDeletedAndRenumber(List *L, Cfg *Func) { | 54 template <typename List> void removeDeletedAndRenumber(List *L, Cfg *Func) { |
| 55 const bool DoDelete = | 55 const bool DoDelete = |
| 56 BuildDefs::minimal() || !GlobalContext::getFlags().getKeepDeletedInsts(); | 56 BuildDefs::minimal() || !getFlags().getKeepDeletedInsts(); |
| 57 auto I = L->begin(), E = L->end(), Next = I; | 57 auto I = L->begin(), E = L->end(), Next = I; |
| 58 for (++Next; I != E; I = Next++) { | 58 for (++Next; I != E; I = Next++) { |
| 59 if (DoDelete && I->isDeleted()) { | 59 if (DoDelete && I->isDeleted()) { |
| 60 L->erase(I); | 60 L->erase(I); |
| 61 } else { | 61 } else { |
| 62 I->renumber(Func); | 62 I->renumber(Func); |
| 63 } | 63 } |
| 64 } | 64 } |
| 65 } | 65 } |
| 66 } // end of anonymous namespace | 66 } // end of anonymous namespace |
| (...skipping 979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1046 } | 1046 } |
| 1047 | 1047 |
| 1048 } // end of anonymous namespace | 1048 } // end of anonymous namespace |
| 1049 | 1049 |
| 1050 void CfgNode::emit(Cfg *Func) const { | 1050 void CfgNode::emit(Cfg *Func) const { |
| 1051 if (!BuildDefs::dump()) | 1051 if (!BuildDefs::dump()) |
| 1052 return; | 1052 return; |
| 1053 Func->setCurrentNode(this); | 1053 Func->setCurrentNode(this); |
| 1054 Ostream &Str = Func->getContext()->getStrEmit(); | 1054 Ostream &Str = Func->getContext()->getStrEmit(); |
| 1055 Liveness *Liveness = Func->getLiveness(); | 1055 Liveness *Liveness = Func->getLiveness(); |
| 1056 const bool DecorateAsm = | 1056 const bool DecorateAsm = Liveness && getFlags().getDecorateAsm(); |
| 1057 Liveness && Func->getContext()->getFlags().getDecorateAsm(); | |
| 1058 Str << getAsmName() << ":\n"; | 1057 Str << getAsmName() << ":\n"; |
| 1059 // LiveRegCount keeps track of the number of currently live variables that | 1058 // LiveRegCount keeps track of the number of currently live variables that |
| 1060 // each register is assigned to. Normally that would be only 0 or 1, but the | 1059 // each register is assigned to. Normally that would be only 0 or 1, but the |
| 1061 // register allocator's AllowOverlap inference allows it to be greater than 1 | 1060 // register allocator's AllowOverlap inference allows it to be greater than 1 |
| 1062 // for short periods. | 1061 // for short periods. |
| 1063 CfgVector<SizeT> LiveRegCount(Func->getTarget()->getNumRegisters()); | 1062 CfgVector<SizeT> LiveRegCount(Func->getTarget()->getNumRegisters()); |
| 1064 if (DecorateAsm) { | 1063 if (DecorateAsm) { |
| 1065 constexpr bool IsLiveIn = true; | 1064 constexpr bool IsLiveIn = true; |
| 1066 emitRegisterUsage(Str, Func, this, IsLiveIn, LiveRegCount); | 1065 emitRegisterUsage(Str, Func, this, IsLiveIn, LiveRegCount); |
| 1067 if (getInEdges().size()) { | 1066 if (getInEdges().size()) { |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1252 // padding nop is a branch target. | 1251 // padding nop is a branch target. |
| 1253 Asm->bindCfgNodeLabel(this); | 1252 Asm->bindCfgNodeLabel(this); |
| 1254 for (const Inst &I : Phis) { | 1253 for (const Inst &I : Phis) { |
| 1255 if (I.isDeleted()) | 1254 if (I.isDeleted()) |
| 1256 continue; | 1255 continue; |
| 1257 // Emitting a Phi instruction should cause an error. | 1256 // Emitting a Phi instruction should cause an error. |
| 1258 I.emitIAS(Func); | 1257 I.emitIAS(Func); |
| 1259 } | 1258 } |
| 1260 | 1259 |
| 1261 // Do the simple emission if not sandboxed. | 1260 // Do the simple emission if not sandboxed. |
| 1262 if (!Func->getContext()->getFlags().getUseSandboxing()) { | 1261 if (!getFlags().getUseSandboxing()) { |
| 1263 for (const Inst &I : Insts) { | 1262 for (const Inst &I : Insts) { |
| 1264 if (!I.isDeleted() && !I.isRedundantAssign()) { | 1263 if (!I.isDeleted() && !I.isRedundantAssign()) { |
| 1265 I.emitIAS(Func); | 1264 I.emitIAS(Func); |
| 1266 updateStats(Func, &I); | 1265 updateStats(Func, &I); |
| 1267 } | 1266 } |
| 1268 } | 1267 } |
| 1269 return; | 1268 return; |
| 1270 } | 1269 } |
| 1271 | 1270 |
| 1272 // The remainder of the function handles emission with sandboxing. There are | 1271 // The remainder of the function handles emission with sandboxing. There are |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1456 auto *Instr = InstIntrinsicCall::create( | 1455 auto *Instr = InstIntrinsicCall::create( |
| 1457 Func, 5, Func->makeVariable(IceType_i64), RMWI64Name, Info->Info); | 1456 Func, 5, Func->makeVariable(IceType_i64), RMWI64Name, Info->Info); |
| 1458 Instr->addArg(AtomicRMWOp); | 1457 Instr->addArg(AtomicRMWOp); |
| 1459 Instr->addArg(Counter); | 1458 Instr->addArg(Counter); |
| 1460 Instr->addArg(One); | 1459 Instr->addArg(One); |
| 1461 Instr->addArg(OrderAcquireRelease); | 1460 Instr->addArg(OrderAcquireRelease); |
| 1462 Insts.push_front(Instr); | 1461 Insts.push_front(Instr); |
| 1463 } | 1462 } |
| 1464 | 1463 |
| 1465 } // end of namespace Ice | 1464 } // end of namespace Ice |
| OLD | NEW |