40#define DEBUG_TYPE "wasm-asm-parser"
49 enum KindTy { Token,
Integer, Float, Symbol, BrList }
Kind;
51 SMLoc StartLoc, EndLoc;
70 std::vector<unsigned>
List;
82 :
Kind(
K), StartLoc(Start), EndLoc(
End), Tok(
T) {}
90 :
Kind(
K), StartLoc(Start), EndLoc(
End), BrL() {}
92 ~WebAssemblyOperand() {
97 bool isToken()
const override {
return Kind == Token; }
99 bool isFPImm()
const {
return Kind ==
Float; }
100 bool isMem()
const override {
return false; }
101 bool isReg()
const override {
return false; }
102 bool isBrList()
const {
return Kind == BrList; }
104 unsigned getReg()
const override {
117 void addRegOperands(
MCInst &,
unsigned)
const {
122 void addImmOperands(
MCInst &Inst,
unsigned N)
const {
123 assert(
N == 1 &&
"Invalid number of operands!");
126 else if (Kind == Symbol)
132 void addFPImmf32Operands(
MCInst &Inst,
unsigned N)
const {
133 assert(
N == 1 &&
"Invalid number of operands!");
141 void addFPImmf64Operands(
MCInst &Inst,
unsigned N)
const {
142 assert(
N == 1 &&
"Invalid number of operands!");
149 void addBrListOperands(
MCInst &Inst,
unsigned N)
const {
150 assert(
N == 1 && isBrList() &&
"Invalid BrList!");
151 for (
auto Br : BrL.List)
158 OS <<
"Tok:" << Tok.Tok;
161 OS <<
"Int:" <<
Int.Val;
164 OS <<
"Flt:" <<
Flt.Val;
167 OS <<
"Sym:" <<
Sym.Exp;
170 OS <<
"BrList:" << BrL.List.size();
185 if (!
Sym->isFunctionTable())
189 Sym->setFunctionTable();
201 std::vector<std::unique_ptr<wasm::WasmSignature>>
Signatures;
202 std::vector<std::unique_ptr<std::string>>
Names;
218 } CurrentState = FileStart;
235 std::vector<Nested> NestingStack;
238 MCSymbol *LastFunctionLabel =
nullptr;
250 Lexer(Parser.getLexer()), is64(STI.getTargetTriple().isArch64Bit()),
251 TC(Parser, MII, is64), SkipTypeCheck(
Options.MCNoTypeCheck) {
257 SM.
getBufferInfo(SM.getMainFileID()).Buffer->getBufferIdentifier();
258 if (BufferName ==
"<inline asm>")
259 SkipTypeCheck =
true;
265 DefaultFunctionTable = GetOrCreateFunctionTableSymbol(
271#define GET_ASSEMBLER_HEADER
272#include "WebAssemblyGenAsmMatcher.inc"
293 void addSignature(std::unique_ptr<wasm::WasmSignature> &&Sig) {
294 Signatures.push_back(std::move(Sig));
298 std::unique_ptr<std::string>
N = std::make_unique<std::string>(
Name);
299 Names.push_back(std::move(
N));
300 return *
Names.back();
303 std::pair<StringRef, StringRef> nestingString(NestingType NT) {
306 return {
"function",
"end_function"};
308 return {
"block",
"end_block"};
310 return {
"loop",
"end_loop"};
312 return {
"try",
"end_try/delegate"};
314 return {
"catch_all",
"end_try"};
316 return {
"if",
"end_if"};
318 return {
"else",
"end_if"};
325 NestingStack.push_back({
NT, Sig});
328 bool pop(
StringRef Ins, NestingType NT1, NestingType NT2 = Undefined) {
329 if (NestingStack.empty())
330 return error(
Twine(
"End of block construct with no start: ") + Ins);
331 auto Top = NestingStack.back();
332 if (Top.NT != NT1 && Top.NT != NT2)
333 return error(
Twine(
"Block construct type mismatch, expected: ") +
334 nestingString(Top.NT).second +
", instead got: " + Ins);
336 NestingStack.pop_back();
342 bool popAndPushWithSameSignature(
StringRef Ins, NestingType PopNT,
343 NestingType PushNT) {
344 if (NestingStack.empty())
345 return error(
Twine(
"End of block construct with no start: ") + Ins);
346 auto Sig = NestingStack.back().Sig;
353 bool ensureEmptyNestingStack(
SMLoc Loc =
SMLoc()) {
354 auto Err = !NestingStack.empty();
355 while (!NestingStack.empty()) {
356 error(
Twine(
"Unmatched block construct(s) at function end: ") +
357 nestingString(NestingStack.back().NT).first,
359 NestingStack.pop_back();
365 auto Ok = Lexer.
is(Kind);
373 return error(std::string(
"Expected ") + KindName +
", instead got: ",
380 error(
"Expected identifier, got: ", Lexer.
getTok());
403 int64_t Val =
Int.getIntVal();
406 Operands.push_back(std::make_unique<WebAssemblyOperand>(
407 WebAssemblyOperand::Integer,
Int.getLoc(),
Int.getEndLoc(),
408 WebAssemblyOperand::IntOp{Val}));
415 if (
Flt.getString().getAsDouble(Val,
false))
416 return error(
"Cannot parse real: ",
Flt);
419 Operands.push_back(std::make_unique<WebAssemblyOperand>(
420 WebAssemblyOperand::Float,
Flt.getLoc(),
Flt.getEndLoc(),
421 WebAssemblyOperand::FltOp{Val}));
430 auto S =
Flt.getString();
432 if (S.compare_insensitive(
"infinity") == 0) {
433 Val = std::numeric_limits<double>::infinity();
434 }
else if (S.compare_insensitive(
"nan") == 0) {
435 Val = std::numeric_limits<double>::quiet_NaN();
441 Operands.push_back(std::make_unique<WebAssemblyOperand>(
442 WebAssemblyOperand::Float,
Flt.getLoc(),
Flt.getEndLoc(),
443 WebAssemblyOperand::FltOp{Val}));
450 auto IsLoadStore = InstName.
contains(
".load") ||
453 auto IsAtomic = InstName.
contains(
"atomic.");
454 if (IsLoadStore || IsAtomic) {
457 auto Id = expectIdent();
459 return error(
"Expected p2align, instead got: " + Id);
463 return error(
"Expected integer constant");
464 parseSingleInteger(
false,
Operands);
469 auto IsLoadStoreLane = InstName.
contains(
"_lane");
470 if (IsLoadStoreLane &&
Operands.size() == 4)
476 auto Tok = Lexer.
getTok();
477 Operands.push_back(std::make_unique<WebAssemblyOperand>(
479 WebAssemblyOperand::IntOp{-1}));
487 if (
BT != WebAssembly::BlockType::Void) {
490 NestingStack.back().Sig = Sig;
492 Operands.push_back(std::make_unique<WebAssemblyOperand>(
493 WebAssemblyOperand::Integer, NameLoc, NameLoc,
494 WebAssemblyOperand::IntOp{
static_cast<int64_t
>(
BT)}));
498 auto Tok = Lexer.
getTok();
500 return error(
"Expected integer constant, instead got: ", Tok);
508 auto Tok = Lexer.
getTok();
510 return error(
"Expected integer constant, instead got: ", Tok);
519 bool parseFunctionTableOperand(std::unique_ptr<WebAssemblyOperand> *Op) {
525 auto &Tok = Lexer.
getTok();
530 *
Op = std::make_unique<WebAssemblyOperand>(
532 WebAssemblyOperand::SymOp{Val});
538 *
Op = std::make_unique<WebAssemblyOperand>(
540 WebAssemblyOperand::SymOp{Val});
548 *
Op = std::make_unique<WebAssemblyOperand>(WebAssemblyOperand::Integer,
550 WebAssemblyOperand::IntOp{0});
565 auto &Sep = Lexer.
getTok();
566 if (Sep.getLoc().getPointer() !=
Name.end() ||
575 Id.getLoc().getPointer() !=
Name.end())
576 return error(
"Incomplete instruction name: ", Id);
582 Operands.push_back(std::make_unique<WebAssemblyOperand>(
584 WebAssemblyOperand::TokOp{Name}));
588 bool ExpectBlockType =
false;
589 bool ExpectFuncType =
false;
590 std::unique_ptr<WebAssemblyOperand> FunctionTable;
591 if (
Name ==
"block") {
593 ExpectBlockType =
true;
594 }
else if (
Name ==
"loop") {
596 ExpectBlockType =
true;
597 }
else if (
Name ==
"try") {
599 ExpectBlockType =
true;
600 }
else if (
Name ==
"if") {
602 ExpectBlockType =
true;
603 }
else if (
Name ==
"else") {
604 if (popAndPushWithSameSignature(
Name, If, Else))
606 }
else if (
Name ==
"catch") {
607 if (popAndPushWithSameSignature(
Name, Try, Try))
609 }
else if (
Name ==
"catch_all") {
610 if (popAndPushWithSameSignature(
Name, Try, CatchAll))
612 }
else if (
Name ==
"end_if") {
613 if (pop(
Name, If, Else))
615 }
else if (
Name ==
"end_try") {
616 if (pop(
Name, Try, CatchAll))
618 }
else if (
Name ==
"delegate") {
621 }
else if (
Name ==
"end_loop") {
624 }
else if (
Name ==
"end_block") {
625 if (pop(
Name, Block))
627 }
else if (
Name ==
"end_function") {
629 CurrentState = EndFunction;
632 }
else if (
Name ==
"call_indirect" ||
Name ==
"return_call_indirect") {
636 if (parseFunctionTableOperand(&FunctionTable))
638 ExpectFuncType =
true;
646 auto Loc = Parser.
getTok();
647 auto Signature = std::make_unique<wasm::WasmSignature>();
648 if (parseSignature(Signature.get()))
653 NestingStack.back().Sig = *Signature.get();
654 ExpectBlockType =
false;
658 auto *WasmSym = cast<MCSymbolWasm>(
Sym);
659 WasmSym->setSignature(Signature.get());
660 addSignature(std::move(Signature));
664 Operands.push_back(std::make_unique<WebAssemblyOperand>(
665 WebAssemblyOperand::Symbol, Loc.getLoc(), Loc.getEndLoc(),
666 WebAssemblyOperand::SymOp{Expr}));
670 auto &Tok = Lexer.
getTok();
673 if (!parseSpecialFloatMaybe(
false,
Operands))
676 if (ExpectBlockType) {
679 if (
BT == WebAssembly::BlockType::Invalid)
680 return error(
"Unknown block type: ", Id);
689 return error(
"Cannot parse symbol: ", Lexer.
getTok());
690 Operands.push_back(std::make_unique<WebAssemblyOperand>(
691 WebAssemblyOperand::Symbol, Start,
End,
692 WebAssemblyOperand::SymOp{Val}));
705 if (parseSingleFloat(
true,
Operands))
707 }
else if (!parseSpecialFloatMaybe(
true,
Operands)) {
709 return error(
"Expected numeric constant instead got: ",
714 parseSingleInteger(
false,
Operands);
719 if (parseSingleFloat(
false,
Operands))
725 auto Op = std::make_unique<WebAssemblyOperand>(
739 return error(
"Unexpected token in operand: ", Tok);
746 if (ExpectBlockType &&
Operands.size() == 1) {
748 addBlockTypeOperand(
Operands, NameLoc, WebAssembly::BlockType::Void);
751 Operands.push_back(std::move(FunctionTable));
759 if (parseRegTypeList(Signature->
Params))
767 if (parseRegTypeList(Signature->
Returns))
774 bool CheckDataSection() {
775 if (CurrentState != DataSection) {
776 auto WS = cast<MCSectionWasm>(
getStreamer().getCurrentSection().first);
777 if (WS && WS->getKind().isText())
778 return error(
"data directive must occur in a data segment: ",
781 CurrentState = DataSection;
799 auto &Ctx = Out.getContext();
803 if (DirectiveID.
getString() ==
".globaltype") {
804 auto SymName = expectIdent();
809 auto TypeTok = Lexer.
getTok();
815 return error(
"Unknown type in .globaltype directive: ", TypeTok);
822 auto Id = expectIdent();
823 if (Id ==
"immutable")
827 return error(
"Unknown type in .globaltype modifier: ", TypeTok);
834 TOut.emitGlobalType(WasmSym);
838 if (DirectiveID.
getString() ==
".tabletype") {
840 auto SymName = expectIdent();
846 auto ElemTypeTok = Lexer.
getTok();
847 auto ElemTypeName = expectIdent();
848 if (ElemTypeName.empty())
850 std::optional<wasm::ValType> ElemType =
853 return error(
"Unknown type in .tabletype directive: ", ElemTypeTok);
864 WasmSym->setTableType(
Type);
865 TOut.emitTableType(WasmSym);
869 if (DirectiveID.
getString() ==
".functype") {
875 auto SymName = expectIdent();
879 if (WasmSym->isDefined()) {
890 if (CurrentState != FunctionLabel) {
892 if (ensureEmptyNestingStack())
896 CurrentState = FunctionStart;
897 LastFunctionLabel = WasmSym;
899 auto Signature = std::make_unique<wasm::WasmSignature>();
900 if (parseSignature(Signature.get()))
903 WasmSym->setSignature(Signature.get());
904 addSignature(std::move(Signature));
906 TOut.emitFunctionType(WasmSym);
911 if (DirectiveID.
getString() ==
".export_name") {
912 auto SymName = expectIdent();
917 auto ExportName = expectIdent();
919 WasmSym->setExportName(storeName(ExportName));
920 TOut.emitExportName(WasmSym, ExportName);
923 if (DirectiveID.
getString() ==
".import_module") {
924 auto SymName = expectIdent();
929 auto ImportModule = expectIdent();
931 WasmSym->setImportModule(storeName(ImportModule));
932 TOut.emitImportModule(WasmSym, ImportModule);
935 if (DirectiveID.
getString() ==
".import_name") {
936 auto SymName = expectIdent();
941 auto ImportName = expectIdent();
943 WasmSym->setImportName(storeName(ImportName));
944 TOut.emitImportName(WasmSym, ImportName);
947 if (DirectiveID.
getString() ==
".tagtype") {
948 auto SymName = expectIdent();
952 auto Signature = std::make_unique<wasm::WasmSignature>();
953 if (parseRegTypeList(Signature->
Params))
955 WasmSym->setSignature(Signature.get());
956 addSignature(std::move(Signature));
958 TOut.emitTagType(WasmSym);
963 if (DirectiveID.
getString() ==
".local") {
964 if (CurrentState != FunctionStart)
965 return error(
".local directive should follow the start of a function: ",
968 if (parseRegTypeList(Locals))
971 TOut.emitLocal(Locals);
972 CurrentState = FunctionLocals;
976 if (DirectiveID.
getString() ==
".int8" ||
980 if (CheckDataSection())
985 return error(
"Cannot parse .int expression: ", Lexer.
getTok());
988 Out.emitValue(Val, NumBits / 8,
End);
992 if (DirectiveID.
getString() ==
".asciz") {
993 if (CheckDataSection())
997 return error(
"Cannot parse string constant: ", Lexer.
getTok());
998 Out.emitBytes(
StringRef(S.c_str(), S.length() + 1));
1007 if (CurrentState == FunctionStart) {
1014 CurrentState = FunctionLocals;
1021 bool MatchingInlineAsm)
override {
1025 unsigned MatchResult = MatchInstructionImpl(
1027 switch (MatchResult) {
1034 if (Op0.getImm() == -1)
1050 if (CurrentState == EndFunction) {
1051 onEndOfFunction(IDLoc);
1058 assert(MissingFeatures.
count() > 0 &&
"Expected missing features");
1061 OS <<
"instruction requires:";
1062 for (
unsigned i = 0, e = MissingFeatures.
size(); i != e; ++i)
1063 if (MissingFeatures.
test(i))
1065 return Parser.
Error(IDLoc, Message);
1068 return Parser.
Error(IDLoc,
"invalid instruction");
1070 return Parser.
Error(IDLoc,
"ambiguous instruction");
1073 SMLoc ErrorLoc = IDLoc;
1076 return Parser.
Error(IDLoc,
"too few operands for instruction");
1078 if (ErrorLoc ==
SMLoc())
1081 return Parser.
Error(ErrorLoc,
"invalid operand for instruction");
1089 auto CWS = cast<MCSectionWasm>(
getStreamer().getCurrentSection().first);
1090 if (!CWS || !CWS->getKind().isText())
1093 auto WasmSym = cast<MCSymbolWasm>(Symbol);
1098 "Wasm doesn\'t support data symbols in text sections");
1105 auto SymName =
Symbol->getName();
1106 if (SymName.startswith(
".L"))
1113 auto SecName =
".text." + SymName;
1115 auto *Group = CWS->getGroup();
1121 WasmSym->setComdat(
true);
1130 if (WasmSym->isFunction()) {
1140 ensureEmptyNestingStack(IDLoc);
1141 CurrentState = FunctionLabel;
1142 LastFunctionLabel =
Symbol;
1147 void onEndOfFunction(
SMLoc ErrorLoc) {
1154 void onEndOfFile()
override { ensureEmptyNestingStack(); }
1164#define GET_REGISTER_MATCHER
1165#define GET_SUBTARGET_FEATURE_NAME
1166#define GET_MATCHER_IMPLEMENTATION
1167#include "WebAssemblyGenAsmMatcher.inc"
1171 for (
auto &ME : MatchTable0) {
1172 if (ME.Opcode == Opc) {
1173 return ME.getMnemonic();
1176 assert(
false &&
"mnemonic not found");
static const char * getSubtargetFeatureName(uint64_t Val)
#define LLVM_EXTERNAL_VISIBILITY
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
mir Rename Register Operands
static GCMetadataPrinterRegistry::Add< OcamlGCMetadataPrinter > Y("ocaml", "ocaml 3.10-compatible collector")
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static const FuncProtoTy Signatures[]
StringRef GetMnemonic(unsigned Opc)
static const char * getSubtargetFeatureName(uint64_t Val)
LLVM_EXTERNAL_VISIBILITY void LLVMInitializeWebAssemblyAsmParser()
This file is part of the WebAssembly Assembler.
This file provides WebAssembly-specific target descriptions.
This file contains the declaration of the WebAssembly-specific type parsing utility functions.
This file registers the WebAssembly target.
This file declares WebAssembly-specific target streamer classes.
This file contains the entry points for global functions defined in the LLVM WebAssembly back-end.
Target independent representation for an assembler token.
int64_t getIntVal() const
StringRef getString() const
Get the string for the current token, this includes all characters (for example, the quotes on string...
bool is(TokenKind K) const
TokenKind getKind() const
Base class for user error types.
Container class for subtarget features.
constexpr bool test(unsigned I) const
constexpr size_t size() const
Represents a single loop in the control flow graph.
Generic assembler lexer interface, for use by target specific assembly lexers.
bool isNot(AsmToken::TokenKind K) const
Check if the current token has kind K.
const AsmToken & getTok() const
Get the current (last) lexed token.
bool is(AsmToken::TokenKind K) const
Check if the current token has kind K.
virtual void Initialize(MCAsmParser &Parser)
Initialize the extension for parsing using the given Parser.
MCStreamer & getStreamer()
Generic assembler parser interface, for use by target specific assembly parsers.
virtual bool parseEscapedString(std::string &Data)=0
Parse the current token as a string which may include escaped characters and return the string conten...
virtual bool parseExpression(const MCExpr *&Res, SMLoc &EndLoc)=0
Parse an arbitrary expression.
virtual SourceMgr & getSourceManager()=0
const AsmToken & getTok() const
Get the current AsmToken from the stream.
virtual const AsmToken & Lex()=0
Get the next AsmToken in the stream, possibly handling file inclusion first.
bool Error(SMLoc L, const Twine &Msg, SMRange Range=std::nullopt)
Return an error at the location L, with the message Msg.
Context object for machine code objects.
MCSymbol * createTempSymbol()
Create a temporary symbol with a unique name.
MCSectionWasm * getWasmSection(const Twine &Section, SectionKind K, unsigned Flags=0)
bool addGenDwarfSection(MCSection *Sec)
MCSymbol * lookupSymbol(const Twine &Name) const
Get the symbol for Name, or null.
@ GenericSectionID
Pass this value as the UniqueID during section creation to get the generic section with the given nam...
void reportError(SMLoc L, const Twine &Msg)
MCSymbol * getOrCreateSymbol(const Twine &Name)
Lookup the symbol inside with the specified Name.
Base class for the full range of assembler expressions which are needed for parsing.
Instances of this class represent a single low-level machine instruction.
unsigned getOpcode() const
void addOperand(const MCOperand Op)
void setOpcode(unsigned Op)
const MCOperand & getOperand(unsigned i) const
Interface to description of machine instruction set.
static MCOperand createExpr(const MCExpr *Val)
static MCOperand createSFPImm(uint32_t Val)
static MCOperand createImm(int64_t Val)
static MCOperand createDFPImm(uint64_t Val)
MCParsedAsmOperand - This abstract class represents a source-level assembly instruction operand.
virtual unsigned getReg() const =0
virtual SMLoc getStartLoc() const =0
getStartLoc - Get the location of the first token of this operand.
virtual bool isReg() const =0
isReg - Is this a register operand?
virtual bool isMem() const =0
isMem - Is this a memory operand?
virtual void print(raw_ostream &OS) const =0
print - Print a debug representation of the operand to the given stream.
virtual bool isToken() const =0
isToken - Is this a token operand?
virtual bool isImm() const =0
isImm - Is this an immediate operand?
virtual SMLoc getEndLoc() const =0
getEndLoc - Get the location of the last token of this operand.
Wrapper class representing physical registers. Should be passed by value.
Streaming machine code generation interface.
virtual void emitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI)
Emit the given Instruction into the current section.
virtual bool emitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute)=0
Add the given Attribute to Symbol.
MCTargetStreamer * getTargetStreamer()
virtual void switchSection(MCSection *Section, const MCExpr *Subsection=nullptr)
Set the current section where code is being emitted to Section.
Generic base class for all target subtargets.
bool checkFeatures(StringRef FS) const
Check whether the subtarget features are enabled/disabled as per the provided string,...
const FeatureBitset & getFeatureBits() const
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx)
void setOmitFromLinkingSection()
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
MCTargetAsmParser - Generic interface to target specific assembly parsers.
virtual bool ParseDirective(AsmToken DirectiveID)=0
ParseDirective - Parse a target specific assembler directive.
@ Match_InvalidTiedOperand
virtual bool parseRegister(MCRegister &Reg, SMLoc &StartLoc, SMLoc &EndLoc)=0
virtual void onEndOfFile()
void setAvailableFeatures(const FeatureBitset &Value)
const MCSubtargetInfo & getSTI() const
virtual void doBeforeLabelEmit(MCSymbol *Symbol, SMLoc IDLoc)
virtual bool ParseInstruction(ParseInstructionInfo &Info, StringRef Name, SMLoc NameLoc, OperandVector &Operands)=0
ParseInstruction - Parse one assembly instruction.
virtual bool MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode, OperandVector &Operands, MCStreamer &Out, uint64_t &ErrorInfo, bool MatchingInlineAsm)=0
MatchAndEmitInstruction - Recognize a series of operands of a parsed instruction as an actual MCInst ...
virtual OperandMatchResultTy tryParseRegister(MCRegister &Reg, SMLoc &StartLoc, SMLoc &EndLoc)=0
tryParseRegister - parse one register if possible
Represents a location in source code.
static SMLoc getFromPointer(const char *Ptr)
const char * getPointer() const
static SectionKind getText()
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
const SrcBuffer & getBufferInfo(unsigned i) const
StringRef - Represent a constant reference to a string, i.e.
bool getAsInteger(unsigned Radix, T &Result) const
Parse the current string as an integer of the specified radix.
StringRef drop_front(size_t N=1) const
Return a StringRef equal to 'this' but with the first N elements dropped.
bool contains(StringRef Other) const
Return true if the given string is a substring of *this, and false otherwise.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
The instances of the Type class are immutable: once they are created, they are never changed.
bool endOfFunction(SMLoc ErrorLoc)
void funcDecl(const wasm::WasmSignature &Sig)
void setLastSig(const wasm::WasmSignature &Sig)
void localDecl(const SmallVectorImpl< wasm::ValType > &Locals)
bool typeCheck(SMLoc ErrorLoc, const MCInst &Inst, OperandVector &Operands)
WebAssembly-specific streamer interface, to implement support WebAssembly-specific assembly directive...
virtual void emitLocal(ArrayRef< wasm::ValType > Types)=0
.local
This class implements an extremely fast bulk output stream that can only output to a stream.
A raw_ostream that writes to an SmallVector or SmallString.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
constexpr char TypeName[]
Key for Kernel::Arg::Metadata::mTypeName.
int getWasm64Opcode(unsigned short Opcode)
BlockType parseBlockType(StringRef Type)
BlockType
Used as immediate MachineOperands for block signatures.
unsigned GetDefaultP2AlignAny(unsigned Opc)
Return the default p2align value for a load or store with the given opcode.
std::optional< wasm::ValType > parseType(StringRef Type)
@ WASM_LIMITS_FLAG_HAS_MAX
@ WASM_SYMBOL_TYPE_GLOBAL
@ WASM_SYMBOL_TYPE_FUNCTION
This is an optimization pass for GlobalISel generic memory operations.
Target & getTheWebAssemblyTarget32()
Target & getTheWebAssemblyTarget64()
@ MCSA_NoDeadStrip
.no_dead_strip (MachO)
This struct is a compact representation of a valid (non-zero power of two) alignment.
RegisterMCAsmParser - Helper template for registering a target specific assembly parser,...
SmallVector< ValType, 1 > Returns
SmallVector< ValType, 4 > Params