[llvm] d8a0dc4 - [NFC] format llvm/lib/Target/WebAssembly/AsmParser
Congcong Cai via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 11 06:41:56 PDT 2023
Author: Congcong Cai
Date: 2023-04-11T15:41:29+02:00
New Revision: d8a0dc425cbf2fdf8415976560b4379bbb976c83
URL: https://github.com/llvm/llvm-project/commit/d8a0dc425cbf2fdf8415976560b4379bbb976c83
DIFF: https://github.com/llvm/llvm-project/commit/d8a0dc425cbf2fdf8415976560b4379bbb976c83.diff
LOG: [NFC] format llvm/lib/Target/WebAssembly/AsmParser
Reviewed By: aheejin
Differential Revision: https://reviews.llvm.org/D147884
Added:
Modified:
llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp
llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmTypeCheck.cpp
llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmTypeCheck.h
Removed:
################################################################################
diff --git a/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp b/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp
index 0e2072f8568a6..e8efb5582c943 100644
--- a/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp
+++ b/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp
@@ -247,15 +247,14 @@ class WebAssemblyAsmParser final : public MCTargetAsmParser {
WebAssemblyAsmParser(const MCSubtargetInfo &STI, MCAsmParser &Parser,
const MCInstrInfo &MII, const MCTargetOptions &Options)
: MCTargetAsmParser(Options, STI, MII), Parser(Parser),
- Lexer(Parser.getLexer()),
- is64(STI.getTargetTriple().isArch64Bit()),
+ Lexer(Parser.getLexer()), is64(STI.getTargetTriple().isArch64Bit()),
TC(Parser, MII, is64), SkipTypeCheck(Options.MCNoTypeCheck) {
setAvailableFeatures(ComputeAvailableFeatures(STI.getFeatureBits()));
// Don't type check if this is inline asm, since that is a naked sequence of
// instructions without a function/locals decl.
auto &SM = Parser.getSourceManager();
auto BufferName =
- SM.getBufferInfo(SM.getMainFileID()).Buffer->getBufferIdentifier();
+ SM.getBufferInfo(SM.getMainFileID()).Buffer->getBufferIdentifier();
if (BufferName == "<inline asm>")
SkipTypeCheck = true;
}
@@ -702,7 +701,7 @@ class WebAssemblyAsmParser final : public MCTargetAsmParser {
parseSingleInteger(true, Operands);
if (checkForP2AlignIfLoadStore(Operands, Name))
return true;
- } else if(Lexer.is(AsmToken::Real)) {
+ } else if (Lexer.is(AsmToken::Real)) {
if (parseSingleFloat(true, Operands))
return true;
} else if (!parseSpecialFloatMaybe(true, Operands)) {
@@ -978,7 +977,8 @@ class WebAssemblyAsmParser final : public MCTargetAsmParser {
DirectiveID.getString() == ".int16" ||
DirectiveID.getString() == ".int32" ||
DirectiveID.getString() == ".int64") {
- if (CheckDataSection()) return true;
+ if (CheckDataSection())
+ return true;
const MCExpr *Val;
SMLoc End;
if (Parser.parseExpression(Val, End))
@@ -990,7 +990,8 @@ class WebAssemblyAsmParser final : public MCTargetAsmParser {
}
if (DirectiveID.getString() == ".asciz") {
- if (CheckDataSection()) return true;
+ if (CheckDataSection())
+ return true;
std::string S;
if (Parser.parseEscapedString(S))
return error("Cannot parse string constant: ", Lexer.getTok());
diff --git a/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmTypeCheck.cpp b/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmTypeCheck.cpp
index 17fb4c6ca5695..8aa538b08d27f 100644
--- a/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmTypeCheck.cpp
+++ b/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmTypeCheck.cpp
@@ -44,9 +44,9 @@ extern StringRef GetMnemonic(unsigned Opc);
namespace llvm {
WebAssemblyAsmTypeCheck::WebAssemblyAsmTypeCheck(MCAsmParser &Parser,
- const MCInstrInfo &MII, bool is64)
- : Parser(Parser), MII(MII), is64(is64) {
-}
+ const MCInstrInfo &MII,
+ bool is64)
+ : Parser(Parser), MII(MII), is64(is64) {}
void WebAssemblyAsmTypeCheck::funcDecl(const wasm::WasmSignature &Sig) {
LocalTypes.assign(Sig.Params.begin(), Sig.Params.end());
@@ -117,7 +117,7 @@ bool WebAssemblyAsmTypeCheck::getLocal(SMLoc ErrorLoc, const MCInst &Inst,
auto Local = static_cast<size_t>(Inst.getOperand(0).getImm());
if (Local >= LocalTypes.size())
return typeError(ErrorLoc, StringRef("no local type specified for index ") +
- std::to_string(Local));
+ std::to_string(Local));
Type = LocalTypes[Local];
return false;
}
@@ -138,17 +138,18 @@ bool WebAssemblyAsmTypeCheck::checkEnd(SMLoc ErrorLoc, bool PopVals) {
auto EVT = LastSig.Returns[i];
auto PVT = Stack[Stack.size() - LastSig.Returns.size() + i];
if (PVT != EVT)
- return typeError(
- ErrorLoc, StringRef("end got ") + WebAssembly::typeToString(PVT) +
- ", expected " + WebAssembly::typeToString(EVT));
+ return typeError(ErrorLoc,
+ StringRef("end got ") + WebAssembly::typeToString(PVT) +
+ ", expected " + WebAssembly::typeToString(EVT));
}
return false;
}
bool WebAssemblyAsmTypeCheck::checkSig(SMLoc ErrorLoc,
- const wasm::WasmSignature& Sig) {
+ const wasm::WasmSignature &Sig) {
for (auto VT : llvm::reverse(Sig.Params))
- if (popType(ErrorLoc, VT)) return true;
+ if (popType(ErrorLoc, VT))
+ return true;
Stack.insert(Stack.end(), Sig.Returns.begin(), Sig.Returns.end());
return false;
}
@@ -187,7 +188,7 @@ bool WebAssemblyAsmTypeCheck::getGlobal(SMLoc ErrorLoc, const MCInst &Inst,
[[fallthrough]];
default:
return typeError(ErrorLoc, StringRef("symbol ") + WasmSym->getName() +
- " missing .globaltype");
+ " missing .globaltype");
}
return false;
}
@@ -325,8 +326,10 @@ bool WebAssemblyAsmTypeCheck::typeCheck(SMLoc ErrorLoc, const MCInst &Inst,
return true;
} else if (Name == "call_indirect" || Name == "return_call_indirect") {
// Function value.
- if (popType(ErrorLoc, wasm::ValType::I32)) return true;
- if (checkSig(ErrorLoc, LastSig)) return true;
+ if (popType(ErrorLoc, wasm::ValType::I32))
+ return true;
+ if (checkSig(ErrorLoc, LastSig))
+ return true;
if (Name == "return_call_indirect" && endOfFunction(ErrorLoc))
return true;
} else if (Name == "call" || Name == "return_call") {
@@ -339,7 +342,8 @@ bool WebAssemblyAsmTypeCheck::typeCheck(SMLoc ErrorLoc, const MCInst &Inst,
return typeError(Operands[1]->getStartLoc(), StringRef("symbol ") +
WasmSym->getName() +
" missing .functype");
- if (checkSig(ErrorLoc, *Sig)) return true;
+ if (checkSig(ErrorLoc, *Sig))
+ return true;
if (Name == "return_call" && endOfFunction(ErrorLoc))
return true;
} else if (Name == "unreachable") {
diff --git a/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmTypeCheck.h b/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmTypeCheck.h
index 1418ffb4aa9cc..fb298c2a11260 100644
--- a/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmTypeCheck.h
+++ b/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmTypeCheck.h
@@ -49,7 +49,8 @@ class WebAssemblyAsmTypeCheck final {
bool getTable(SMLoc ErrorLoc, const MCInst &Inst, wasm::ValType &Type);
public:
- WebAssemblyAsmTypeCheck(MCAsmParser &Parser, const MCInstrInfo &MII, bool is64);
+ WebAssemblyAsmTypeCheck(MCAsmParser &Parser, const MCInstrInfo &MII,
+ bool is64);
void funcDecl(const wasm::WasmSignature &Sig);
void localDecl(const SmallVectorImpl<wasm::ValType> &Locals);
@@ -68,4 +69,4 @@ class WebAssemblyAsmTypeCheck final {
} // end namespace llvm
-#endif // LLVM_LIB_TARGET_WEBASSEMBLY_ASMPARSER_TYPECHECK_H
+#endif // LLVM_LIB_TARGET_WEBASSEMBLY_ASMPARSER_TYPECHECK_H
More information about the llvm-commits
mailing list