41#define DEBUG_TYPE "wasm-asm-parser"
50 enum KindTy { Token,
Integer, Float, Symbol, BrList }
Kind;
52 SMLoc StartLoc, EndLoc;
71 std::vector<unsigned>
List;
82 WebAssemblyOperand(KindTy K,
SMLoc Start,
SMLoc End, TokOp
T)
83 :
Kind(K), StartLoc(Start), EndLoc(End), Tok(
T) {}
84 WebAssemblyOperand(KindTy K,
SMLoc Start,
SMLoc End, IntOp
I)
85 :
Kind(K), StartLoc(Start), EndLoc(End),
Int(
I) {}
86 WebAssemblyOperand(KindTy K,
SMLoc Start,
SMLoc End, FltOp
F)
87 :
Kind(K), StartLoc(Start), EndLoc(End),
Flt(
F) {}
88 WebAssemblyOperand(KindTy K,
SMLoc Start,
SMLoc End, SymOp S)
89 :
Kind(K), StartLoc(Start), EndLoc(End), Sym(S) {}
90 WebAssemblyOperand(KindTy K,
SMLoc Start,
SMLoc End)
91 :
Kind(K), StartLoc(Start), EndLoc(End), BrL() {}
93 ~WebAssemblyOperand() {
98 bool isToken()
const override {
return Kind == Token; }
100 bool isFPImm()
const {
return Kind ==
Float; }
101 bool isMem()
const override {
return false; }
102 bool isReg()
const override {
return false; }
103 bool isBrList()
const {
return Kind == BrList; }
105 unsigned getReg()
const override {
118 void addRegOperands(
MCInst &,
unsigned)
const {
123 void addImmOperands(
MCInst &Inst,
unsigned N)
const {
124 assert(
N == 1 &&
"Invalid number of operands!");
127 else if (Kind == Symbol)
133 void addFPImmf32Operands(
MCInst &Inst,
unsigned N)
const {
134 assert(
N == 1 &&
"Invalid number of operands!");
142 void addFPImmf64Operands(
MCInst &Inst,
unsigned N)
const {
143 assert(
N == 1 &&
"Invalid number of operands!");
150 void addBrListOperands(
MCInst &Inst,
unsigned N)
const {
151 assert(
N == 1 && isBrList() &&
"Invalid BrList!");
152 for (
auto Br : BrL.List)
159 OS <<
"Tok:" << Tok.Tok;
162 OS <<
"Int:" <<
Int.Val;
165 OS <<
"Flt:" <<
Flt.Val;
168 OS <<
"Sym:" << Sym.Exp;
171 OS <<
"BrList:" << BrL.List.size();
202 std::vector<std::unique_ptr<wasm::WasmSignature>>
Signatures;
203 std::vector<std::unique_ptr<std::string>> Names;
219 } CurrentState = FileStart;
236 std::vector<Nested> NestingStack;
239 MCSymbol *LastFunctionLabel =
nullptr;
251 Lexer(Parser.getLexer()),
252 is64(STI.getTargetTriple().isArch64Bit()),
253 TC(Parser, MII, is64), SkipTypeCheck(
Options.MCNoTypeCheck) {
259 SM.
getBufferInfo(SM.getMainFileID()).Buffer->getBufferIdentifier();
260 if (BufferName ==
"<inline asm>")
261 SkipTypeCheck =
true;
267 DefaultFunctionTable = GetOrCreateFunctionTableSymbol(
273#define GET_ASSEMBLER_HEADER
274#include "WebAssemblyGenAsmMatcher.inc"
295 void addSignature(std::unique_ptr<wasm::WasmSignature> &&Sig) {
296 Signatures.push_back(std::move(Sig));
300 std::unique_ptr<std::string>
N = std::make_unique<std::string>(
Name);
301 Names.push_back(std::move(
N));
302 return *Names.back();
305 std::pair<StringRef, StringRef> nestingString(NestingType NT) {
308 return {
"function",
"end_function"};
310 return {
"block",
"end_block"};
312 return {
"loop",
"end_loop"};
314 return {
"try",
"end_try/delegate"};
316 return {
"catch_all",
"end_try"};
318 return {
"if",
"end_if"};
320 return {
"else",
"end_if"};
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();
340 bool ensureEmptyNestingStack(
SMLoc Loc =
SMLoc()) {
341 auto Err = !NestingStack.empty();
342 while (!NestingStack.empty()) {
343 error(
Twine(
"Unmatched block construct(s) at function end: ") +
344 nestingString(NestingStack.back().NT).first,
346 NestingStack.pop_back();
352 auto Ok = Lexer.
is(Kind);
360 return error(std::string(
"Expected ") + KindName +
", instead got: ",
367 error(
"Expected identifier, got: ", Lexer.
getTok());
390 int64_t Val =
Int.getIntVal();
393 Operands.push_back(std::make_unique<WebAssemblyOperand>(
394 WebAssemblyOperand::Integer,
Int.getLoc(),
Int.getEndLoc(),
395 WebAssemblyOperand::IntOp{Val}));
402 if (
Flt.getString().getAsDouble(Val,
false))
403 return error(
"Cannot parse real: ",
Flt);
406 Operands.push_back(std::make_unique<WebAssemblyOperand>(
407 WebAssemblyOperand::Float,
Flt.getLoc(),
Flt.getEndLoc(),
408 WebAssemblyOperand::FltOp{Val}));
417 auto S =
Flt.getString();
419 if (S.compare_insensitive(
"infinity") == 0) {
420 Val = std::numeric_limits<double>::infinity();
421 }
else if (S.compare_insensitive(
"nan") == 0) {
422 Val = std::numeric_limits<double>::quiet_NaN();
428 Operands.push_back(std::make_unique<WebAssemblyOperand>(
429 WebAssemblyOperand::Float,
Flt.getLoc(),
Flt.getEndLoc(),
430 WebAssemblyOperand::FltOp{Val}));
437 auto IsLoadStore = InstName.
contains(
".load") ||
440 auto IsAtomic = InstName.
contains(
"atomic.");
441 if (IsLoadStore || IsAtomic) {
444 auto Id = expectIdent();
446 return error(
"Expected p2align, instead got: " + Id);
450 return error(
"Expected integer constant");
451 parseSingleInteger(
false,
Operands);
456 auto IsLoadStoreLane = InstName.
contains(
"_lane");
457 if (IsLoadStoreLane &&
Operands.size() == 4)
463 auto Tok = Lexer.
getTok();
464 Operands.push_back(std::make_unique<WebAssemblyOperand>(
466 WebAssemblyOperand::IntOp{-1}));
474 if (
BT != WebAssembly::BlockType::Void) {
477 NestingStack.back().Sig = Sig;
479 Operands.push_back(std::make_unique<WebAssemblyOperand>(
480 WebAssemblyOperand::Integer, NameLoc, NameLoc,
481 WebAssemblyOperand::IntOp{
static_cast<int64_t
>(
BT)}));
485 auto Tok = Lexer.
getTok();
487 return error(
"Expected integer constant, instead got: ", Tok);
495 auto Tok = Lexer.
getTok();
497 return error(
"Expected integer constant, instead got: ", Tok);
506 bool parseFunctionTableOperand(std::unique_ptr<WebAssemblyOperand> *Op) {
512 auto &Tok = Lexer.
getTok();
517 *
Op = std::make_unique<WebAssemblyOperand>(
519 WebAssemblyOperand::SymOp{Val});
525 *
Op = std::make_unique<WebAssemblyOperand>(
527 WebAssemblyOperand::SymOp{Val});
535 *
Op = std::make_unique<WebAssemblyOperand>(WebAssemblyOperand::Integer,
537 WebAssemblyOperand::IntOp{0});
552 auto &Sep = Lexer.
getTok();
553 if (Sep.getLoc().getPointer() !=
Name.end() ||
562 Id.getLoc().getPointer() !=
Name.end())
563 return error(
"Incomplete instruction name: ", Id);
569 Operands.push_back(std::make_unique<WebAssemblyOperand>(
571 WebAssemblyOperand::TokOp{Name}));
575 bool ExpectBlockType =
false;
576 bool ExpectFuncType =
false;
577 std::unique_ptr<WebAssemblyOperand> FunctionTable;
578 if (
Name ==
"block") {
580 ExpectBlockType =
true;
581 }
else if (
Name ==
"loop") {
583 ExpectBlockType =
true;
584 }
else if (
Name ==
"try") {
586 ExpectBlockType =
true;
587 }
else if (
Name ==
"if") {
589 ExpectBlockType =
true;
590 }
else if (
Name ==
"else") {
594 }
else if (
Name ==
"catch") {
598 }
else if (
Name ==
"catch_all") {
602 }
else if (
Name ==
"end_if") {
603 if (pop(
Name, If, Else))
605 }
else if (
Name ==
"end_try") {
606 if (pop(
Name, Try, CatchAll))
608 }
else if (
Name ==
"delegate") {
611 }
else if (
Name ==
"end_loop") {
614 }
else if (
Name ==
"end_block") {
615 if (pop(
Name, Block))
617 }
else if (
Name ==
"end_function") {
619 CurrentState = EndFunction;
622 }
else if (
Name ==
"call_indirect" ||
Name ==
"return_call_indirect") {
626 if (parseFunctionTableOperand(&FunctionTable))
628 ExpectFuncType =
true;
636 auto Loc = Parser.
getTok();
637 auto Signature = std::make_unique<wasm::WasmSignature>();
638 if (parseSignature(Signature.get()))
641 ExpectBlockType =
false;
644 NestingStack.back().Sig = *Signature.get();
648 auto *WasmSym = cast<MCSymbolWasm>(Sym);
649 WasmSym->setSignature(Signature.get());
650 addSignature(std::move(Signature));
654 Operands.push_back(std::make_unique<WebAssemblyOperand>(
655 WebAssemblyOperand::Symbol, Loc.getLoc(), Loc.getEndLoc(),
656 WebAssemblyOperand::SymOp{Expr}));
660 auto &Tok = Lexer.
getTok();
663 if (!parseSpecialFloatMaybe(
false,
Operands))
666 if (ExpectBlockType) {
669 if (
BT == WebAssembly::BlockType::Invalid)
670 return error(
"Unknown block type: ", Id);
679 return error(
"Cannot parse symbol: ", Lexer.
getTok());
680 Operands.push_back(std::make_unique<WebAssemblyOperand>(
681 WebAssemblyOperand::Symbol, Start, End,
682 WebAssemblyOperand::SymOp{Val}));
695 if (parseSingleFloat(
true,
Operands))
697 }
else if (!parseSpecialFloatMaybe(
true,
Operands)) {
699 return error(
"Expected numeric constant instead got: ",
704 parseSingleInteger(
false,
Operands);
709 if (parseSingleFloat(
false,
Operands))
715 auto Op = std::make_unique<WebAssemblyOperand>(
729 return error(
"Unexpected token in operand: ", Tok);
736 if (ExpectBlockType &&
Operands.size() == 1) {
738 addBlockTypeOperand(
Operands, NameLoc, WebAssembly::BlockType::Void);
741 Operands.push_back(std::move(FunctionTable));
749 if (parseRegTypeList(Signature->
Params))
757 if (parseRegTypeList(Signature->
Returns))
764 bool CheckDataSection() {
765 if (CurrentState != DataSection) {
766 auto WS = cast<MCSectionWasm>(
getStreamer().getCurrentSection().first);
767 if (WS && WS->getKind().isText())
768 return error(
"data directive must occur in a data segment: ",
771 CurrentState = DataSection;
789 auto &Ctx = Out.getContext();
793 if (DirectiveID.
getString() ==
".globaltype") {
794 auto SymName = expectIdent();
799 auto TypeTok = Lexer.
getTok();
805 return error(
"Unknown type in .globaltype directive: ", TypeTok);
812 auto Id = expectIdent();
813 if (Id ==
"immutable")
817 return error(
"Unknown type in .globaltype modifier: ", TypeTok);
824 TOut.emitGlobalType(WasmSym);
828 if (DirectiveID.
getString() ==
".tabletype") {
830 auto SymName = expectIdent();
836 auto ElemTypeTok = Lexer.
getTok();
837 auto ElemTypeName = expectIdent();
838 if (ElemTypeName.empty())
840 std::optional<wasm::ValType> ElemType =
843 return error(
"Unknown type in .tabletype directive: ", ElemTypeTok);
854 WasmSym->setTableType(
Type);
855 TOut.emitTableType(WasmSym);
859 if (DirectiveID.
getString() ==
".functype") {
865 auto SymName = expectIdent();
869 if (WasmSym->isDefined()) {
880 if (CurrentState != FunctionLabel) {
882 if (ensureEmptyNestingStack())
886 CurrentState = FunctionStart;
887 LastFunctionLabel = WasmSym;
889 auto Signature = std::make_unique<wasm::WasmSignature>();
890 if (parseSignature(Signature.get()))
893 WasmSym->setSignature(Signature.get());
894 addSignature(std::move(Signature));
896 TOut.emitFunctionType(WasmSym);
901 if (DirectiveID.
getString() ==
".export_name") {
902 auto SymName = expectIdent();
907 auto ExportName = expectIdent();
909 WasmSym->setExportName(storeName(ExportName));
910 TOut.emitExportName(WasmSym, ExportName);
913 if (DirectiveID.
getString() ==
".import_module") {
914 auto SymName = expectIdent();
919 auto ImportModule = expectIdent();
921 WasmSym->setImportModule(storeName(ImportModule));
922 TOut.emitImportModule(WasmSym, ImportModule);
925 if (DirectiveID.
getString() ==
".import_name") {
926 auto SymName = expectIdent();
931 auto ImportName = expectIdent();
933 WasmSym->setImportName(storeName(ImportName));
934 TOut.emitImportName(WasmSym, ImportName);
937 if (DirectiveID.
getString() ==
".tagtype") {
938 auto SymName = expectIdent();
942 auto Signature = std::make_unique<wasm::WasmSignature>();
943 if (parseRegTypeList(Signature->
Params))
945 WasmSym->setSignature(Signature.get());
946 addSignature(std::move(Signature));
948 TOut.emitTagType(WasmSym);
953 if (DirectiveID.
getString() ==
".local") {
954 if (CurrentState != FunctionStart)
955 return error(
".local directive should follow the start of a function: ",
958 if (parseRegTypeList(Locals))
961 TOut.emitLocal(Locals);
962 CurrentState = FunctionLocals;
966 if (DirectiveID.
getString() ==
".int8" ||
970 if (CheckDataSection())
return true;
974 return error(
"Cannot parse .int expression: ", Lexer.
getTok());
977 Out.emitValue(Val, NumBits / 8, End);
981 if (DirectiveID.
getString() ==
".asciz") {
982 if (CheckDataSection())
return true;
985 return error(
"Cannot parse string constant: ", Lexer.
getTok());
986 Out.emitBytes(
StringRef(S.c_str(), S.length() + 1));
995 if (CurrentState == FunctionStart) {
1002 CurrentState = FunctionLocals;
1009 bool MatchingInlineAsm)
override {
1013 unsigned MatchResult = MatchInstructionImpl(
1015 switch (MatchResult) {
1022 if (Op0.getImm() == -1)
1038 if (CurrentState == EndFunction) {
1039 onEndOfFunction(IDLoc);
1046 assert(MissingFeatures.
count() > 0 &&
"Expected missing features");
1049 OS <<
"instruction requires:";
1050 for (
unsigned i = 0, e = MissingFeatures.
size(); i != e; ++i)
1051 if (MissingFeatures.
test(i))
1053 return Parser.
Error(IDLoc, Message);
1056 return Parser.
Error(IDLoc,
"invalid instruction");
1058 return Parser.
Error(IDLoc,
"ambiguous instruction");
1061 SMLoc ErrorLoc = IDLoc;
1064 return Parser.
Error(IDLoc,
"too few operands for instruction");
1066 if (ErrorLoc ==
SMLoc())
1069 return Parser.
Error(ErrorLoc,
"invalid operand for instruction");
1077 auto CWS = cast<MCSectionWasm>(
getStreamer().getCurrentSection().first);
1078 if (!CWS || !CWS->getKind().isText())
1081 auto WasmSym = cast<MCSymbolWasm>(Symbol);
1086 "Wasm doesn\'t support data symbols in text sections");
1093 auto SymName =
Symbol->getName();
1094 if (SymName.startswith(
".L"))
1101 auto SecName =
".text." + SymName;
1103 auto *Group = CWS->getGroup();
1109 WasmSym->setComdat(
true);
1118 if (WasmSym->isFunction()) {
1128 ensureEmptyNestingStack(IDLoc);
1129 CurrentState = FunctionLabel;
1130 LastFunctionLabel =
Symbol;
1135 void onEndOfFunction(
SMLoc ErrorLoc) {
1142 void onEndOfFile()
override { ensureEmptyNestingStack(); }
1152#define GET_REGISTER_MATCHER
1153#define GET_SUBTARGET_FEATURE_NAME
1154#define GET_MATCHER_IMPLEMENTATION
1155#include "WebAssemblyGenAsmMatcher.inc"
1159 for (
auto &ME : MatchTable0) {
1160 if (ME.Opcode == Opc) {
1161 return ME.getMnemonic();
1164 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 registers the WebAssembly target.
This file declares WebAssembly-specific target streamer classes.
This file contains the declaration of the WebAssembly-specific type parsing utility functions.
This file contains the declaration of the WebAssembly-specific utility functions.
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)
bool isFunctionTable() const
void setOmitFromLinkingSection()
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
void setUndefined()
Mark the symbol as undefined.
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)
bool typeCheck(SMLoc ErrorLoc, const MCInst &Inst, OperandVector &Operands)
void localDecl(const SmallVector< wasm::ValType, 4 > &Locals)
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