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"
279 SMLoc &EndLoc)
override {
291 void addSignature(std::unique_ptr<wasm::WasmSignature> &&Sig) {
292 Signatures.push_back(std::move(Sig));
296 std::unique_ptr<std::string>
N = std::make_unique<std::string>(
Name);
297 Names.push_back(std::move(
N));
298 return *Names.back();
301 std::pair<StringRef, StringRef> nestingString(NestingType NT) {
304 return {
"function",
"end_function"};
306 return {
"block",
"end_block"};
308 return {
"loop",
"end_loop"};
310 return {
"try",
"end_try/delegate"};
312 return {
"catch_all",
"end_try"};
314 return {
"if",
"end_if"};
316 return {
"else",
"end_if"};
323 NestingStack.push_back({
NT, Sig});
326 bool pop(
StringRef Ins, NestingType NT1, NestingType NT2 = Undefined) {
327 if (NestingStack.empty())
328 return error(
Twine(
"End of block construct with no start: ") + Ins);
329 auto Top = NestingStack.back();
330 if (Top.NT != NT1 && Top.NT != NT2)
331 return error(
Twine(
"Block construct type mismatch, expected: ") +
332 nestingString(Top.NT).second +
", instead got: " + Ins);
334 NestingStack.pop_back();
340 bool popAndPushWithSameSignature(
StringRef Ins, NestingType PopNT,
341 NestingType PushNT) {
342 if (NestingStack.empty())
343 return error(
Twine(
"End of block construct with no start: ") + Ins);
344 auto Sig = NestingStack.back().Sig;
351 bool ensureEmptyNestingStack(
SMLoc Loc =
SMLoc()) {
352 auto Err = !NestingStack.empty();
353 while (!NestingStack.empty()) {
354 error(
Twine(
"Unmatched block construct(s) at function end: ") +
355 nestingString(NestingStack.back().NT).first,
357 NestingStack.pop_back();
363 auto Ok = Lexer.
is(Kind);
371 return error(std::string(
"Expected ") + KindName +
", instead got: ",
378 error(
"Expected identifier, got: ", Lexer.
getTok());
401 int64_t Val =
Int.getIntVal();
404 Operands.push_back(std::make_unique<WebAssemblyOperand>(
405 WebAssemblyOperand::Integer,
Int.getLoc(),
Int.getEndLoc(),
406 WebAssemblyOperand::IntOp{Val}));
413 if (
Flt.getString().getAsDouble(Val,
false))
414 return error(
"Cannot parse real: ",
Flt);
417 Operands.push_back(std::make_unique<WebAssemblyOperand>(
418 WebAssemblyOperand::Float,
Flt.getLoc(),
Flt.getEndLoc(),
419 WebAssemblyOperand::FltOp{Val}));
428 auto S =
Flt.getString();
430 if (S.compare_insensitive(
"infinity") == 0) {
431 Val = std::numeric_limits<double>::infinity();
432 }
else if (S.compare_insensitive(
"nan") == 0) {
433 Val = std::numeric_limits<double>::quiet_NaN();
439 Operands.push_back(std::make_unique<WebAssemblyOperand>(
440 WebAssemblyOperand::Float,
Flt.getLoc(),
Flt.getEndLoc(),
441 WebAssemblyOperand::FltOp{Val}));
448 auto IsLoadStore = InstName.
contains(
".load") ||
451 auto IsAtomic = InstName.
contains(
"atomic.");
452 if (IsLoadStore || IsAtomic) {
455 auto Id = expectIdent();
457 return error(
"Expected p2align, instead got: " + Id);
461 return error(
"Expected integer constant");
462 parseSingleInteger(
false,
Operands);
467 auto IsLoadStoreLane = InstName.
contains(
"_lane");
468 if (IsLoadStoreLane &&
Operands.size() == 4)
474 auto Tok = Lexer.
getTok();
475 Operands.push_back(std::make_unique<WebAssemblyOperand>(
477 WebAssemblyOperand::IntOp{-1}));
485 if (
BT != WebAssembly::BlockType::Void) {
488 NestingStack.back().Sig = Sig;
490 Operands.push_back(std::make_unique<WebAssemblyOperand>(
491 WebAssemblyOperand::Integer, NameLoc, NameLoc,
492 WebAssemblyOperand::IntOp{
static_cast<int64_t
>(
BT)}));
496 auto Tok = Lexer.
getTok();
498 return error(
"Expected integer constant, instead got: ", Tok);
506 auto Tok = Lexer.
getTok();
508 return error(
"Expected integer constant, instead got: ", Tok);
517 bool parseFunctionTableOperand(std::unique_ptr<WebAssemblyOperand> *
Op) {
523 auto &Tok = Lexer.
getTok();
528 *
Op = std::make_unique<WebAssemblyOperand>(
530 WebAssemblyOperand::SymOp{Val});
536 *
Op = std::make_unique<WebAssemblyOperand>(
538 WebAssemblyOperand::SymOp{Val});
546 *
Op = std::make_unique<WebAssemblyOperand>(WebAssemblyOperand::Integer,
548 WebAssemblyOperand::IntOp{0});
563 auto &Sep = Lexer.
getTok();
564 if (Sep.getLoc().getPointer() !=
Name.end() ||
573 Id.getLoc().getPointer() !=
Name.end())
574 return error(
"Incomplete instruction name: ", Id);
580 Operands.push_back(std::make_unique<WebAssemblyOperand>(
582 WebAssemblyOperand::TokOp{Name}));
586 bool ExpectBlockType =
false;
587 bool ExpectFuncType =
false;
588 std::unique_ptr<WebAssemblyOperand> FunctionTable;
589 if (
Name ==
"block") {
591 ExpectBlockType =
true;
592 }
else if (
Name ==
"loop") {
594 ExpectBlockType =
true;
595 }
else if (
Name ==
"try") {
597 ExpectBlockType =
true;
598 }
else if (
Name ==
"if") {
600 ExpectBlockType =
true;
601 }
else if (
Name ==
"else") {
602 if (popAndPushWithSameSignature(
Name, If, Else))
604 }
else if (
Name ==
"catch") {
605 if (popAndPushWithSameSignature(
Name, Try, Try))
607 }
else if (
Name ==
"catch_all") {
608 if (popAndPushWithSameSignature(
Name, Try, CatchAll))
610 }
else if (
Name ==
"end_if") {
611 if (pop(
Name, If, Else))
613 }
else if (
Name ==
"end_try") {
614 if (pop(
Name, Try, CatchAll))
616 }
else if (
Name ==
"delegate") {
619 }
else if (
Name ==
"end_loop") {
622 }
else if (
Name ==
"end_block") {
623 if (pop(
Name, Block))
625 }
else if (
Name ==
"end_function") {
627 CurrentState = EndFunction;
630 }
else if (
Name ==
"call_indirect" ||
Name ==
"return_call_indirect") {
634 if (parseFunctionTableOperand(&FunctionTable))
636 ExpectFuncType =
true;
644 auto Loc = Parser.
getTok();
645 auto Signature = std::make_unique<wasm::WasmSignature>();
646 if (parseSignature(Signature.get()))
651 NestingStack.back().Sig = *Signature.get();
652 ExpectBlockType =
false;
656 auto *WasmSym = cast<MCSymbolWasm>(
Sym);
657 WasmSym->setSignature(Signature.get());
658 addSignature(std::move(Signature));
662 Operands.push_back(std::make_unique<WebAssemblyOperand>(
663 WebAssemblyOperand::Symbol, Loc.getLoc(), Loc.getEndLoc(),
664 WebAssemblyOperand::SymOp{Expr}));
668 auto &Tok = Lexer.
getTok();
671 if (!parseSpecialFloatMaybe(
false,
Operands))
674 if (ExpectBlockType) {
677 if (
BT == WebAssembly::BlockType::Invalid)
678 return error(
"Unknown block type: ", Id);
687 return error(
"Cannot parse symbol: ", Lexer.
getTok());
688 Operands.push_back(std::make_unique<WebAssemblyOperand>(
689 WebAssemblyOperand::Symbol, Start,
End,
690 WebAssemblyOperand::SymOp{Val}));
703 if (parseSingleFloat(
true,
Operands))
705 }
else if (!parseSpecialFloatMaybe(
true,
Operands)) {
707 return error(
"Expected numeric constant instead got: ",
712 parseSingleInteger(
false,
Operands);
717 if (parseSingleFloat(
false,
Operands))
723 auto Op = std::make_unique<WebAssemblyOperand>(
737 return error(
"Unexpected token in operand: ", Tok);
744 if (ExpectBlockType &&
Operands.size() == 1) {
746 addBlockTypeOperand(
Operands, NameLoc, WebAssembly::BlockType::Void);
749 Operands.push_back(std::move(FunctionTable));
757 if (parseRegTypeList(Signature->
Params))
765 if (parseRegTypeList(Signature->
Returns))
772 bool CheckDataSection() {
773 if (CurrentState != DataSection) {
774 auto WS = cast<MCSectionWasm>(
getStreamer().getCurrentSection().first);
775 if (WS && WS->getKind().isText())
776 return error(
"data directive must occur in a data segment: ",
779 CurrentState = DataSection;
791 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();
815 if (Id ==
"immutable")
819 return error(
"Unknown type in .globaltype modifier: ", TypeTok);
826 TOut.emitGlobalType(WasmSym);
830 if (DirectiveID.
getString() ==
".tabletype") {
832 auto SymName = expectIdent();
838 auto ElemTypeTok = Lexer.
getTok();
839 auto ElemTypeName = expectIdent();
840 if (ElemTypeName.empty())
842 std::optional<wasm::ValType> ElemType =
845 return error(
"Unknown type in .tabletype directive: ", ElemTypeTok);
856 WasmSym->setTableType(
Type);
857 TOut.emitTableType(WasmSym);
861 if (DirectiveID.
getString() ==
".functype") {
867 auto SymName = expectIdent();
871 if (WasmSym->isDefined()) {
882 if (CurrentState != FunctionLabel) {
884 if (ensureEmptyNestingStack())
888 CurrentState = FunctionStart;
889 LastFunctionLabel = WasmSym;
891 auto Signature = std::make_unique<wasm::WasmSignature>();
892 if (parseSignature(Signature.get()))
895 WasmSym->setSignature(Signature.get());
896 addSignature(std::move(Signature));
898 TOut.emitFunctionType(WasmSym);
903 if (DirectiveID.
getString() ==
".export_name") {
904 auto SymName = expectIdent();
909 auto ExportName = expectIdent();
910 if (ExportName.empty())
913 WasmSym->setExportName(storeName(ExportName));
914 TOut.emitExportName(WasmSym, ExportName);
918 if (DirectiveID.
getString() ==
".import_module") {
919 auto SymName = expectIdent();
924 auto ImportModule = expectIdent();
925 if (ImportModule.empty())
928 WasmSym->setImportModule(storeName(ImportModule));
929 TOut.emitImportModule(WasmSym, ImportModule);
933 if (DirectiveID.
getString() ==
".import_name") {
934 auto SymName = expectIdent();
939 auto ImportName = expectIdent();
940 if (ImportName.
empty())
943 WasmSym->setImportName(storeName(ImportName));
944 TOut.emitImportName(WasmSym, ImportName);
948 if (DirectiveID.
getString() ==
".tagtype") {
949 auto SymName = expectIdent();
953 auto Signature = std::make_unique<wasm::WasmSignature>();
954 if (parseRegTypeList(Signature->
Params))
956 WasmSym->setSignature(Signature.get());
957 addSignature(std::move(Signature));
959 TOut.emitTagType(WasmSym);
964 if (DirectiveID.
getString() ==
".local") {
965 if (CurrentState != FunctionStart)
966 return error(
".local directive should follow the start of a function: ",
969 if (parseRegTypeList(Locals))
972 TOut.emitLocal(Locals);
973 CurrentState = FunctionLocals;
977 if (DirectiveID.
getString() ==
".int8" ||
981 if (CheckDataSection())
986 return error(
"Cannot parse .int expression: ", Lexer.
getTok());
989 Out.emitValue(Val, NumBits / 8,
End);
993 if (DirectiveID.
getString() ==
".asciz") {
994 if (CheckDataSection())
998 return error(
"Cannot parse string constant: ", Lexer.
getTok());
999 Out.emitBytes(
StringRef(S.c_str(), S.length() + 1));
1008 if (CurrentState == FunctionStart) {
1015 CurrentState = FunctionLocals;
1022 bool MatchingInlineAsm)
override {
1026 unsigned MatchResult = MatchInstructionImpl(
1028 switch (MatchResult) {
1035 if (Op0.getImm() == -1)
1051 if (CurrentState == EndFunction) {
1052 onEndOfFunction(IDLoc);
1059 assert(MissingFeatures.
count() > 0 &&
"Expected missing features");
1062 OS <<
"instruction requires:";
1063 for (
unsigned i = 0, e = MissingFeatures.
size(); i != e; ++i)
1064 if (MissingFeatures.
test(i))
1066 return Parser.
Error(IDLoc, Message);
1069 return Parser.
Error(IDLoc,
"invalid instruction");
1071 return Parser.
Error(IDLoc,
"ambiguous instruction");
1074 SMLoc ErrorLoc = IDLoc;
1077 return Parser.
Error(IDLoc,
"too few operands for instruction");
1079 if (ErrorLoc ==
SMLoc())
1082 return Parser.
Error(ErrorLoc,
"invalid operand for instruction");
1090 auto CWS = cast<MCSectionWasm>(
getStreamer().getCurrentSection().first);
1091 if (!CWS || !CWS->getKind().isText())
1094 auto WasmSym = cast<MCSymbolWasm>(Symbol);
1099 "Wasm doesn\'t support data symbols in text sections");
1106 auto SymName =
Symbol->getName();
1107 if (SymName.startswith(
".L"))
1114 auto SecName =
".text." + SymName;
1116 auto *Group = CWS->getGroup();
1122 WasmSym->setComdat(
true);
1131 if (WasmSym->isFunction()) {
1141 ensureEmptyNestingStack(IDLoc);
1142 CurrentState = FunctionLabel;
1143 LastFunctionLabel =
Symbol;
1148 void onEndOfFunction(
SMLoc ErrorLoc) {
1155 void onEndOfFile()
override { ensureEmptyNestingStack(); }
1165#define GET_REGISTER_MATCHER
1166#define GET_SUBTARGET_FEATURE_NAME
1167#define GET_MATCHER_IMPLEMENTATION
1168#include "WebAssemblyGenAsmMatcher.inc"
1172 for (
auto &ME : MatchTable0) {
1173 if (ME.Opcode == Opc) {
1174 return ME.getMnemonic();
1177 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
This class represents an Operation in the Expression.
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.
@ GenericSectionID
Pass this value as the UniqueID during section creation to get the generic section with the given nam...
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.
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 ParseStatus parseDirective(AsmToken DirectiveID)
Parses a target-specific assembler directive.
@ Match_InvalidTiedOperand
virtual bool parseRegister(MCRegister &Reg, SMLoc &StartLoc, SMLoc &EndLoc)=0
virtual ParseStatus tryParseRegister(MCRegister &Reg, SMLoc &StartLoc, SMLoc &EndLoc)=0
tryParseRegister - parse one register if possible
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 ...
Ternary parse status returned by various parse* methods.
static constexpr StatusTy Failure
static constexpr StatusTy NoMatch
Represents a location in source code.
static SMLoc getFromPointer(const char *Ptr)
constexpr 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.
constexpr bool empty() const
empty - Check if the string is empty.
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