Skip to content

Commit 6a420eb

Browse files
committed
[llvm-exegesis] Add HasNoSchedulingInfo flag to MCInstDesc.
This allows llvm-exegesis to skip instructions that lack scheduling information, avoiding invalid benchmarking. e.g. `InstB` in RISC-V.
1 parent 7a3bcf9 commit 6a420eb

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

llvm/include/llvm/MC/MCInstrDesc.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ enum Flag {
188188
Trap,
189189
VariadicOpsAreDefs,
190190
Authenticated,
191+
HasNoSchedulingInfo,
191192
};
192193
} // namespace MCID
193194

@@ -430,6 +431,11 @@ class MCInstrDesc {
430431
return Flags & (1ULL << MCID::Authenticated);
431432
}
432433

434+
/// Return true if this instruction has no scheduling info.
435+
bool hasNoSchedulingInfo() const {
436+
return Flags & (1ULL << MCID::HasNoSchedulingInfo);
437+
}
438+
433439
//===--------------------------------------------------------------------===//
434440
// Side Effect Analysis
435441
//===--------------------------------------------------------------------===//

llvm/tools/llvm-exegesis/lib/Target.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ ExegesisTarget::getIgnoredOpcodeReasonOrNull(const LLVMState &State,
4545
return "Unsupported opcode: isBranch/isIndirectBranch";
4646
if (InstrDesc.isCall() || InstrDesc.isReturn())
4747
return "Unsupported opcode: isCall/isReturn";
48+
if (InstrDesc.hasNoSchedulingInfo())
49+
return "Unsupported opcode: hasNoSchedulingInfo";
4850
return nullptr;
4951
}
5052

llvm/utils/TableGen/InstrInfoEmitter.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1199,6 +1199,8 @@ void InstrInfoEmitter::emitRecord(
11991199
OS << "|(1ULL<<MCID::VariadicOpsAreDefs)";
12001200
if (Inst.isAuthenticated)
12011201
OS << "|(1ULL<<MCID::Authenticated)";
1202+
if (Inst.hasNoSchedulingInfo)
1203+
OS << "|(1ULL<<MCID::HasNoSchedulingInfo)";
12021204

12031205
// Emit all of the target-specific flags...
12041206
const BitsInit *TSF = Inst.TheDef->getValueAsBitsInit("TSFlags");

0 commit comments

Comments
 (0)