@@ -61,7 +61,7 @@ template <> struct FlowGraphTrait<const BasicBlock> {
61
61
return llvm::succ_end (BB);
62
62
}
63
63
static StringValue getName (const BasicBlock *BB) {
64
- return BB->getName (). str ();
64
+ return BB->getNameOrAsOperand ();
65
65
}
66
66
};
67
67
template <> struct FlowGraphTrait <MachineBasicBlock> {
@@ -221,10 +221,10 @@ yaml::FlowFact<yaml::StringValue> *PMLBitcodeExport::createLoopFact(const BasicB
221
221
222
222
auto *FF = new yaml::FlowFact<yaml::StringValue>(yaml::level_bitcode);
223
223
224
- FF->setLoopScope (Fn->getName ().str (), BB->getName (). str ());
224
+ FF->setLoopScope (Fn->getName ().str (), BB->getNameOrAsOperand ());
225
225
226
226
yaml::ProgramPoint *Block =
227
- yaml::ProgramPoint::CreateBlock (Fn->getName ().str (), BB->getName (). str ());
227
+ yaml::ProgramPoint::CreateBlock (Fn->getName ().str (), BB->getNameOrAsOperand ());
228
228
229
229
FF->addTermLHS (Block, 1LL );
230
230
FF->RHS = RHS;
@@ -247,27 +247,24 @@ void PMLBitcodeExport::serialize(MachineFunction &MF)
247
247
yaml::BitcodeFunction *F = new yaml::BitcodeFunction (Fn.getName ().str ());
248
248
F->Level = yaml::level_bitcode;
249
249
yaml::BitcodeBlock *B;
250
- for (Function::const_iterator BI = Fn.begin (), BE = Fn.end (); BI != BE;
250
+ for (auto BI = Fn.begin (), BE = Fn.end (); BI != BE;
251
251
++BI) {
252
- if (BI->getName ().empty ()) {
253
- llvm::errs () << " warning: unnamed bit-code BB in PML export\n " ;
254
- }
255
- B = F->addBlock (new yaml::BitcodeBlock (BI->getName ().str ()));
252
+ B = F->addBlock (new yaml::BitcodeBlock (BI->getNameOrAsOperand ()));
256
253
257
254
Loop *Loop = LI.getLoopFor (&*BI);
258
255
while (Loop) {
259
- B->Loops .push_back (Loop->getHeader ()->getName (). str ());
256
+ B->Loops .push_back (Loop->getHeader ()->getNameOrAsOperand ());
260
257
Loop = Loop->getParentLoop ();
261
258
}
262
259
263
260
// / B->MapsTo = (maybe C-source debug info?)
264
- for (const_pred_iterator PI = pred_begin (&*BI), PE = pred_end (&*BI);
261
+ for (auto PI = pred_begin (&*BI), PE = pred_end (&*BI);
265
262
PI != PE; ++PI) {
266
- B->Predecessors .push_back ((*PI)->getName (). str ());
263
+ B->Predecessors .push_back ((*PI)->getNameOrAsOperand ());
267
264
}
268
265
for (auto SI = succ_begin (&*BI), SE = succ_end (&*BI);
269
266
SI != SE; ++SI) {
270
- B->Successors .push_back ((*SI)->getName (). str ());
267
+ B->Successors .push_back ((*SI)->getNameOrAsOperand ());
271
268
}
272
269
273
270
unsigned Index = 0 ;
@@ -849,7 +846,7 @@ void addProgressNodes(yaml::RelationGraph *RG,
849
846
}
850
847
else {
851
848
RN = RG->addNode (yaml::rnt_progress);
852
- RN->setSrcBlock (IQI->first ->getName (). str ());
849
+ RN->setSrcBlock (IQI->first ->getNameOrAsOperand ());
853
850
RN->setDstBlock (MQI->first ->getNumber ());
854
851
RMap.insert (std::make_pair (PNID, RN));
855
852
RTodo.push_back (std::make_pair (PNID, RN));
@@ -935,7 +932,7 @@ void PMLRelationGraphExport::serialize(MachineFunction &MF)
935
932
auto *SrcScope = new yaml::RelationScope<yaml::StringValue>(
936
933
BF.getName ().str (), yaml::level_bitcode);
937
934
RG = new yaml::RelationGraph (SrcScope, DstScope);
938
- RG->getEntryNode ()->setSrcBlock (BF.getEntryBlock ().getName (). str ());
935
+ RG->getEntryNode ()->setSrcBlock (BF.getEntryBlock ().getNameOrAsOperand ());
939
936
RG->getEntryNode ()->setDstBlock (MF.front ().getNumber ());
940
937
UnmatchedEvents.clear ();
941
938
@@ -974,7 +971,7 @@ void PMLRelationGraphExport::serialize(MachineFunction &MF)
974
971
// MBB, resp.), which results in new src/dst nodes being created, and
975
972
// two bitcode and machinecode-level maps from events to a list of
976
973
// (bitcode/machine block, list of RG predecessor blocks) pairs
977
- expandProgressNode (RG, RN, yaml::rnt_src, [](auto *node, auto * block){node->setSrcBlock (block->getName (). str ());}, IBB, IEventMap, IEvents);
974
+ expandProgressNode (RG, RN, yaml::rnt_src, [](auto *node, auto * block){node->setSrcBlock (block->getNameOrAsOperand ());}, IBB, IEventMap, IEvents);
978
975
expandProgressNode (RG, RN, yaml::rnt_dst, [](auto *node, auto * block){node->setDstBlock (block->getNumber ());}, MBB, MEventMap, MEvents);
979
976
980
977
// For each event and corresponding bitcode list IList and machinecode
0 commit comments