llvm.org GIT mirror llvm / 71e4421
[llvm-mca] InstrBuilder: warnings for call/ret instructions are only reported once. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347514 91177308-0d34-0410-b5e6-96231b3b80d8 Andrea Di Biagio 9 months ago
2 changed file(s) with 16 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
4545 DenseMap> Descriptors;
4646 DenseMap> VariantDescriptors;
4747
48 bool FirstCallInst;
49 bool FirstReturnInst;
50
4851 Expected createInstrDescImpl(const MCInst &MCI);
4952 Expected getOrCreateInstrDesc(const MCInst &MCI);
5053
5962 InstrBuilder(const MCSubtargetInfo &STI, const MCInstrInfo &MCII,
6063 const MCRegisterInfo &RI, const MCInstrAnalysis &IA);
6164
62 void clear() { VariantDescriptors.shrink_and_clear(); }
65 void clear() {
66 VariantDescriptors.shrink_and_clear();
67 FirstCallInst = true;
68 FirstReturnInst = true;
69 }
6370
6471 Expected> createInstruction(const MCInst &MCI);
6572 };
2828 const llvm::MCInstrInfo &mcii,
2929 const llvm::MCRegisterInfo &mri,
3030 const llvm::MCInstrAnalysis &mcia)
31 : STI(sti), MCII(mcii), MRI(mri), MCIA(mcia) {
31 : STI(sti), MCII(mcii), MRI(mri), MCIA(mcia), FirstCallInst(true),
32 FirstReturnInst(true) {
3233 computeProcResourceMasks(STI.getSchedModel(), ProcResourceMasks);
3334 }
3435
454455 std::unique_ptr ID = llvm::make_unique();
455456 ID->NumMicroOps = SCDesc.NumMicroOps;
456457
457 if (MCDesc.isCall()) {
458 if (MCDesc.isCall() && FirstCallInst) {
458459 // We don't correctly model calls.
459460 WithColor::warning() << "found a call in the input assembly sequence.\n";
460461 WithColor::note() << "call instructions are not correctly modeled. "
461462 << "Assume a latency of 100cy.\n";
462 }
463
464 if (MCDesc.isReturn()) {
463 FirstCallInst = false;
464 }
465
466 if (MCDesc.isReturn() && FirstReturnInst) {
465467 WithColor::warning() << "found a return instruction in the input"
466468 << " assembly sequence.\n";
467469 WithColor::note() << "program counter updates are ignored.\n";
470 FirstReturnInst = false;
468471 }
469472
470473 ID->MayLoad = MCDesc.mayLoad();