[PATCH] D151930: [X86][MC] Use MCInstrDesc to access CondCode operand
Amir Ayupov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 1 19:00:20 PDT 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rG15a719de01b9: [X86][MC] Use MCInstrDesc to access CondCode operand (authored by Amir).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D151930/new/
https://reviews.llvm.org/D151930
Files:
llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
Index: llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
===================================================================
--- llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
+++ llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
@@ -231,20 +231,23 @@
: X86::getOpcodeForLongImmediateForm(Opcode);
}
-static X86::CondCode getCondFromBranch(const MCInst &MI) {
+static X86::CondCode getCondFromBranch(const MCInst &MI,
+ const MCInstrInfo &MCII) {
unsigned Opcode = MI.getOpcode();
switch (Opcode) {
default:
return X86::COND_INVALID;
- case X86::JCC_1:
+ case X86::JCC_1: {
+ const MCInstrDesc &Desc = MCII.get(Opcode);
return static_cast<X86::CondCode>(
- MI.getOperand(MI.getNumOperands() - 1).getImm());
+ MI.getOperand(Desc.getNumOperands() - 1).getImm());
+ }
}
}
static X86::SecondMacroFusionInstKind
-classifySecondInstInMacroFusion(const MCInst &MI) {
- X86::CondCode CC = getCondFromBranch(MI);
+classifySecondInstInMacroFusion(const MCInst &MI, const MCInstrInfo &MCII) {
+ X86::CondCode CC = getCondFromBranch(MI, MCII);
return classifySecondCondCodeInMacroFusion(CC);
}
@@ -351,7 +354,7 @@
const X86::FirstMacroFusionInstKind CmpKind =
X86::classifyFirstOpcodeInMacroFusion(Cmp.getOpcode());
const X86::SecondMacroFusionInstKind BranchKind =
- classifySecondInstInMacroFusion(Jcc);
+ classifySecondInstInMacroFusion(Jcc, *MCII);
return X86::isMacroFused(CmpKind, BranchKind);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151930.527701.patch
Type: text/x-patch
Size: 1556 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230602/dd34f7be/attachment.bin>
More information about the llvm-commits
mailing list