[WebAssembly] Use MCRegister::id(). NFC#167609
Merged
Conversation
Member
|
@llvm/pr-subscribers-backend-webassembly Author: Craig Topper (topperc) ChangesFull diff: https://github.com/llvm/llvm-project/pull/167609.diff 2 Files Affected:
diff --git a/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyInstPrinter.cpp b/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyInstPrinter.cpp
index d8bfed9dc0390..651f631c1ee55 100644
--- a/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyInstPrinter.cpp
+++ b/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyInstPrinter.cpp
@@ -317,8 +317,8 @@ void WebAssemblyInstPrinter::printOperand(const MCInst *MI, unsigned OpNo,
const MCOperand &Op = MI->getOperand(OpNo);
if (Op.isReg()) {
const MCInstrDesc &Desc = MII.get(MI->getOpcode());
- unsigned WAReg = Op.getReg();
- if (int(WAReg) >= 0)
+ MCRegister WAReg = Op.getReg();
+ if (int(WAReg.id()) >= 0)
printRegName(O, WAReg);
else if (OpNo >= Desc.getNumDefs() && !IsVariadicDef)
O << "$pop" << WebAssembly::getWARegStackId(WAReg);
diff --git a/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.h b/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.h
index fe9a4bada2430..5dc0e3aa91622 100644
--- a/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.h
+++ b/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.h
@@ -608,9 +608,9 @@ inline bool isLocalTee(unsigned Opc) {
static const unsigned UnusedReg = -1u;
// For a given stackified WAReg, return the id number to print with push/pop.
-unsigned inline getWARegStackId(unsigned Reg) {
- assert(Reg & INT32_MIN);
- return Reg & INT32_MAX;
+unsigned inline getWARegStackId(MCRegister Reg) {
+ assert(Reg.id() & INT32_MIN);
+ return Reg.id() & INT32_MAX;
}
} // end namespace WebAssembly
|
arsenm
reviewed
Nov 12, 2025
arsenm
approved these changes
Nov 12, 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.