Skip to content

Commit ab76d0f

Browse files
committed
Make the checking of LPAD a predicate in RISCVInstrPredicate.td
1 parent a2ce049 commit ab76d0f

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

llvm/lib/Target/RISCV/RISCVInstrInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3512,7 +3512,7 @@ RISCVInstrInfo::getOutliningTypeImpl(const MachineModuleInfo &MMI,
35123512
}
35133513

35143514
// LPADs should not be outlined too
3515-
if (MI.getOpcode() == RISCV::AUIPC && MI.getOperand(0).getReg() == RISCV::X0)
3515+
if (isLPAD(MI))
35163516
return outliner::InstrType::Illegal;
35173517

35183518
return outliner::InstrType::Legal;

llvm/lib/Target/RISCV/RISCVInstrPredicates.td

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,15 @@ def isNonZeroLoadImmediate
148148
CheckNot<CheckImmOperand<2, 0>>
149149
]>>>;
150150

151+
// Returns true if this is LPAD (auipc with rd = x0)
152+
def isLPAD
153+
: TIIPredicate<"isLPAD",
154+
MCReturnStatement<CheckAll<[
155+
CheckOpcode<[AUIPC]>,
156+
CheckIsRegOperand<0>,
157+
CheckRegOperand<0, X0>,
158+
]>>>;
159+
151160
def ignoresVXRM
152161
: TIIPredicate<"ignoresVXRM",
153162
MCOpcodeSwitchStatement<

0 commit comments

Comments
 (0)