-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[WebAssembly] Remove Kind argument from WebAssemblyOperand (NFC) #107157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
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
The `Kind` argument does not need to passed separately.
@llvm/pr-subscribers-backend-webassembly Author: Heejin Ahn (aheejin) ChangesThe Full diff: https://github.com/llvm/llvm-project/pull/107157.diff 1 Files Affected:
diff --git a/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp b/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp
index c63740d267819c..24a9ad67cfe042 100644
--- a/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp
+++ b/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp
@@ -77,16 +77,16 @@ struct WebAssemblyOperand : public MCParsedAsmOperand {
struct BrLOp BrL;
};
- WebAssemblyOperand(KindTy K, SMLoc Start, SMLoc End, TokOp T)
- : Kind(K), StartLoc(Start), EndLoc(End), Tok(T) {}
- WebAssemblyOperand(KindTy K, SMLoc Start, SMLoc End, IntOp I)
- : Kind(K), StartLoc(Start), EndLoc(End), Int(I) {}
- WebAssemblyOperand(KindTy K, SMLoc Start, SMLoc End, FltOp F)
- : Kind(K), StartLoc(Start), EndLoc(End), Flt(F) {}
- WebAssemblyOperand(KindTy K, SMLoc Start, SMLoc End, SymOp S)
- : Kind(K), StartLoc(Start), EndLoc(End), Sym(S) {}
- WebAssemblyOperand(KindTy K, SMLoc Start, SMLoc End)
- : Kind(K), StartLoc(Start), EndLoc(End), BrL() {}
+ WebAssemblyOperand(SMLoc Start, SMLoc End, TokOp T)
+ : Kind(Token), StartLoc(Start), EndLoc(End), Tok(T) {}
+ WebAssemblyOperand(SMLoc Start, SMLoc End, IntOp I)
+ : Kind(Integer), StartLoc(Start), EndLoc(End), Int(I) {}
+ WebAssemblyOperand(SMLoc Start, SMLoc End, FltOp F)
+ : Kind(Float), StartLoc(Start), EndLoc(End), Flt(F) {}
+ WebAssemblyOperand(SMLoc Start, SMLoc End, SymOp S)
+ : Kind(Symbol), StartLoc(Start), EndLoc(End), Sym(S) {}
+ WebAssemblyOperand(SMLoc Start, SMLoc End)
+ : Kind(BrList), StartLoc(Start), EndLoc(End), BrL() {}
~WebAssemblyOperand() {
if (isBrList())
@@ -388,8 +388,7 @@ class WebAssemblyAsmParser final : public MCTargetAsmParser {
if (IsNegative)
Val = -Val;
Operands.push_back(std::make_unique<WebAssemblyOperand>(
- WebAssemblyOperand::Integer, Int.getLoc(), Int.getEndLoc(),
- WebAssemblyOperand::IntOp{Val}));
+ Int.getLoc(), Int.getEndLoc(), WebAssemblyOperand::IntOp{Val}));
Parser.Lex();
}
@@ -401,8 +400,7 @@ class WebAssemblyAsmParser final : public MCTargetAsmParser {
if (IsNegative)
Val = -Val;
Operands.push_back(std::make_unique<WebAssemblyOperand>(
- WebAssemblyOperand::Float, Flt.getLoc(), Flt.getEndLoc(),
- WebAssemblyOperand::FltOp{Val}));
+ Flt.getLoc(), Flt.getEndLoc(), WebAssemblyOperand::FltOp{Val}));
Parser.Lex();
return false;
}
@@ -423,8 +421,7 @@ class WebAssemblyAsmParser final : public MCTargetAsmParser {
if (IsNegative)
Val = -Val;
Operands.push_back(std::make_unique<WebAssemblyOperand>(
- WebAssemblyOperand::Float, Flt.getLoc(), Flt.getEndLoc(),
- WebAssemblyOperand::FltOp{Val}));
+ Flt.getLoc(), Flt.getEndLoc(), WebAssemblyOperand::FltOp{Val}));
Parser.Lex();
return false;
}
@@ -459,8 +456,7 @@ class WebAssemblyAsmParser final : public MCTargetAsmParser {
// up later.
auto Tok = Lexer.getTok();
Operands.push_back(std::make_unique<WebAssemblyOperand>(
- WebAssemblyOperand::Integer, Tok.getLoc(), Tok.getEndLoc(),
- WebAssemblyOperand::IntOp{-1}));
+ Tok.getLoc(), Tok.getEndLoc(), WebAssemblyOperand::IntOp{-1}));
}
}
return false;
@@ -474,8 +470,7 @@ class WebAssemblyAsmParser final : public MCTargetAsmParser {
NestingStack.back().Sig = Sig;
}
Operands.push_back(std::make_unique<WebAssemblyOperand>(
- WebAssemblyOperand::Integer, NameLoc, NameLoc,
- WebAssemblyOperand::IntOp{static_cast<int64_t>(BT)}));
+ NameLoc, NameLoc, WebAssemblyOperand::IntOp{static_cast<int64_t>(BT)}));
}
bool parseLimits(wasm::WasmLimits *Limits) {
@@ -512,16 +507,14 @@ class WebAssemblyAsmParser final : public MCTargetAsmParser {
GetOrCreateFunctionTableSymbol(getContext(), Tok.getString(), is64);
const auto *Val = MCSymbolRefExpr::create(Sym, getContext());
*Op = std::make_unique<WebAssemblyOperand>(
- WebAssemblyOperand::Symbol, Tok.getLoc(), Tok.getEndLoc(),
- WebAssemblyOperand::SymOp{Val});
+ Tok.getLoc(), Tok.getEndLoc(), WebAssemblyOperand::SymOp{Val});
Parser.Lex();
return expect(AsmToken::Comma, ",");
} else {
const auto *Val =
MCSymbolRefExpr::create(DefaultFunctionTable, getContext());
*Op = std::make_unique<WebAssemblyOperand>(
- WebAssemblyOperand::Symbol, SMLoc(), SMLoc(),
- WebAssemblyOperand::SymOp{Val});
+ SMLoc(), SMLoc(), WebAssemblyOperand::SymOp{Val});
return false;
}
} else {
@@ -529,8 +522,7 @@ class WebAssemblyAsmParser final : public MCTargetAsmParser {
// write a table symbol or issue relocations. Instead we just ensure the
// table is live and write a zero.
getStreamer().emitSymbolAttribute(DefaultFunctionTable, MCSA_NoDeadStrip);
- *Op = std::make_unique<WebAssemblyOperand>(WebAssemblyOperand::Integer,
- SMLoc(), SMLoc(),
+ *Op = std::make_unique<WebAssemblyOperand>(SMLoc(), SMLoc(),
WebAssemblyOperand::IntOp{0});
return false;
}
@@ -564,7 +556,7 @@ class WebAssemblyAsmParser final : public MCTargetAsmParser {
// Now construct the name as first operand.
Operands.push_back(std::make_unique<WebAssemblyOperand>(
- WebAssemblyOperand::Token, NameLoc, SMLoc::getFromPointer(Name.end()),
+ NameLoc, SMLoc::getFromPointer(Name.end()),
WebAssemblyOperand::TokOp{Name}));
// If this instruction is part of a control flow structure, ensure
@@ -645,8 +637,7 @@ class WebAssemblyAsmParser final : public MCTargetAsmParser {
const MCExpr *Expr = MCSymbolRefExpr::create(
WasmSym, MCSymbolRefExpr::VK_WASM_TYPEINDEX, Ctx);
Operands.push_back(std::make_unique<WebAssemblyOperand>(
- WebAssemblyOperand::Symbol, Loc.getLoc(), Loc.getEndLoc(),
- WebAssemblyOperand::SymOp{Expr}));
+ Loc.getLoc(), Loc.getEndLoc(), WebAssemblyOperand::SymOp{Expr}));
}
while (Lexer.isNot(AsmToken::EndOfStatement)) {
@@ -671,8 +662,7 @@ class WebAssemblyAsmParser final : public MCTargetAsmParser {
if (Parser.parseExpression(Val, End))
return error("Cannot parse symbol: ", Lexer.getTok());
Operands.push_back(std::make_unique<WebAssemblyOperand>(
- WebAssemblyOperand::Symbol, Start, End,
- WebAssemblyOperand::SymOp{Val}));
+ Start, End, WebAssemblyOperand::SymOp{Val}));
if (checkForP2AlignIfLoadStore(Operands, Name))
return true;
}
@@ -705,8 +695,8 @@ class WebAssemblyAsmParser final : public MCTargetAsmParser {
}
case AsmToken::LCurly: {
Parser.Lex();
- auto Op = std::make_unique<WebAssemblyOperand>(
- WebAssemblyOperand::BrList, Tok.getLoc(), Tok.getEndLoc());
+ auto Op =
+ std::make_unique<WebAssemblyOperand>(Tok.getLoc(), Tok.getEndLoc());
if (!Lexer.is(AsmToken::RCurly))
for (;;) {
Op->BrL.List.push_back(Lexer.getTok().getIntVal());
|
dschuff
approved these changes
Sep 3, 2024
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.
The
Kind
argument does not need to passed separately.