[X86] Remove implicit conversions of MCRegister to unsigned. NFC#167648
Merged
[X86] Remove implicit conversions of MCRegister to unsigned. NFC#167648
Conversation
Member
|
@llvm/pr-subscribers-backend-x86 Author: Craig Topper (topperc) ChangesFull diff: https://github.com/llvm/llvm-project/pull/167648.diff 4 Files Affected:
diff --git a/llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp b/llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
index 74de51c7eb1cc..e67b138afafec 100644
--- a/llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
+++ b/llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
@@ -1391,7 +1391,7 @@ class DarwinX86AsmBackend : public X86AsmBackend {
return CU::UNWIND_MODE_DWARF;
MCRegister Reg = *MRI.getLLVMRegNum(Inst.getRegister(), true);
- SavedRegs[SavedRegIdx++] = Reg;
+ SavedRegs[SavedRegIdx++] = Reg.id();
StackAdjust += OffsetSize;
MinAbsOffset = std::min(MinAbsOffset, std::abs(Inst.getOffset()));
InstrOffset += PushInstrSize(Reg);
diff --git a/llvm/lib/Target/X86/MCTargetDesc/X86InstPrinterCommon.cpp b/llvm/lib/Target/X86/MCTargetDesc/X86InstPrinterCommon.cpp
index 759d95e5a18ea..88dd5431f586b 100644
--- a/llvm/lib/Target/X86/MCTargetDesc/X86InstPrinterCommon.cpp
+++ b/llvm/lib/Target/X86/MCTargetDesc/X86InstPrinterCommon.cpp
@@ -451,7 +451,7 @@ void X86InstPrinterCommon::printVKPair(const MCInst *MI, unsigned OpNo,
// the assembly would look something like:
// "vp2intersect %zmm5, %zmm7, {%k2, %k3}"
// but this can work too.
- switch (MI->getOperand(OpNo).getReg()) {
+ switch (MI->getOperand(OpNo).getReg().id()) {
case X86::K0_K1:
printRegName(OS, X86::K0);
return;
diff --git a/llvm/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp b/llvm/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp
index af5a69899844c..0c874b7e6d674 100644
--- a/llvm/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp
+++ b/llvm/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp
@@ -535,7 +535,7 @@ bool X86MCInstrAnalysis::clearsSuperRegisters(const MCRegisterInfo &MRI,
const MCRegisterClass &VR128XRC = MRI.getRegClass(X86::VR128XRegClassID);
const MCRegisterClass &VR256XRC = MRI.getRegClass(X86::VR256XRegClassID);
- auto ClearsSuperReg = [=](unsigned RegID) {
+ auto ClearsSuperReg = [=](MCRegister RegID) {
// On X86-64, a general purpose integer register is viewed as a 64-bit
// register internal to the processor.
// An update to the lower 32 bits of a 64 bit integer register is
diff --git a/llvm/lib/Target/X86/MCTargetDesc/X86WinCOFFTargetStreamer.cpp b/llvm/lib/Target/X86/MCTargetDesc/X86WinCOFFTargetStreamer.cpp
index 9c442319c220f..b722964a571b3 100644
--- a/llvm/lib/Target/X86/MCTargetDesc/X86WinCOFFTargetStreamer.cpp
+++ b/llvm/lib/Target/X86/MCTargetDesc/X86WinCOFFTargetStreamer.cpp
@@ -55,6 +55,7 @@ struct FPOInstruction {
StackAlign,
SetFrame,
} Op;
+ // FIXME: This should be a union of MCRegister and unsigned.
unsigned RegOrOffset;
};
@@ -215,7 +216,7 @@ bool X86WinCOFFTargetStreamer::emitFPOSetFrame(MCRegister Reg, SMLoc L) {
FPOInstruction Inst;
Inst.Label = emitFPOLabel();
Inst.Op = FPOInstruction::SetFrame;
- Inst.RegOrOffset = Reg;
+ Inst.RegOrOffset = Reg.id();
CurFPOData->Instructions.push_back(Inst);
return false;
}
@@ -226,7 +227,7 @@ bool X86WinCOFFTargetStreamer::emitFPOPushReg(MCRegister Reg, SMLoc L) {
FPOInstruction Inst;
Inst.Label = emitFPOLabel();
Inst.Op = FPOInstruction::PushReg;
- Inst.RegOrOffset = Reg;
+ Inst.RegOrOffset = Reg.id();
CurFPOData->Instructions.push_back(Inst);
return false;
}
|
RKSimon
approved these changes
Nov 12, 2025
git-crd
pushed a commit
to git-crd/crd-llvm-project
that referenced
this pull request
Nov 13, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.