forked from OSchip/llvm-project
[llvm-mca] InstrBuilder: warnings for call/ret instructions are only reported once.
llvm-svn: 347514
This commit is contained in:
parent
e0466f570e
commit
42720603c4
|
@ -46,6 +46,9 @@ class InstrBuilder {
|
|||
DenseMap<unsigned short, std::unique_ptr<const InstrDesc>> Descriptors;
|
||||
DenseMap<const MCInst *, std::unique_ptr<const InstrDesc>> VariantDescriptors;
|
||||
|
||||
bool FirstCallInst;
|
||||
bool FirstReturnInst;
|
||||
|
||||
Expected<const InstrDesc &> createInstrDescImpl(const MCInst &MCI);
|
||||
Expected<const InstrDesc &> getOrCreateInstrDesc(const MCInst &MCI);
|
||||
|
||||
|
@ -60,7 +63,11 @@ public:
|
|||
InstrBuilder(const MCSubtargetInfo &STI, const MCInstrInfo &MCII,
|
||||
const MCRegisterInfo &RI, const MCInstrAnalysis &IA);
|
||||
|
||||
void clear() { VariantDescriptors.shrink_and_clear(); }
|
||||
void clear() {
|
||||
VariantDescriptors.shrink_and_clear();
|
||||
FirstCallInst = true;
|
||||
FirstReturnInst = true;
|
||||
}
|
||||
|
||||
Expected<std::unique_ptr<Instruction>> createInstruction(const MCInst &MCI);
|
||||
};
|
||||
|
|
|
@ -29,7 +29,8 @@ InstrBuilder::InstrBuilder(const llvm::MCSubtargetInfo &sti,
|
|||
const llvm::MCInstrInfo &mcii,
|
||||
const llvm::MCRegisterInfo &mri,
|
||||
const llvm::MCInstrAnalysis &mcia)
|
||||
: STI(sti), MCII(mcii), MRI(mri), MCIA(mcia) {
|
||||
: STI(sti), MCII(mcii), MRI(mri), MCIA(mcia), FirstCallInst(true),
|
||||
FirstReturnInst(true) {
|
||||
computeProcResourceMasks(STI.getSchedModel(), ProcResourceMasks);
|
||||
}
|
||||
|
||||
|
@ -455,17 +456,19 @@ InstrBuilder::createInstrDescImpl(const MCInst &MCI) {
|
|||
std::unique_ptr<InstrDesc> ID = llvm::make_unique<InstrDesc>();
|
||||
ID->NumMicroOps = SCDesc.NumMicroOps;
|
||||
|
||||
if (MCDesc.isCall()) {
|
||||
if (MCDesc.isCall() && FirstCallInst) {
|
||||
// We don't correctly model calls.
|
||||
WithColor::warning() << "found a call in the input assembly sequence.\n";
|
||||
WithColor::note() << "call instructions are not correctly modeled. "
|
||||
<< "Assume a latency of 100cy.\n";
|
||||
FirstCallInst = false;
|
||||
}
|
||||
|
||||
if (MCDesc.isReturn()) {
|
||||
if (MCDesc.isReturn() && FirstReturnInst) {
|
||||
WithColor::warning() << "found a return instruction in the input"
|
||||
<< " assembly sequence.\n";
|
||||
WithColor::note() << "program counter updates are ignored.\n";
|
||||
FirstReturnInst = false;
|
||||
}
|
||||
|
||||
ID->MayLoad = MCDesc.mayLoad();
|
||||
|
|
Loading…
Reference in New Issue