Go to the documentation of this file.
39 template<
bool (WasmAsmParser::*HandlerMethod)(StringRef, SMLoc)>
42 this, HandleDirective<WasmAsmParser, HandlerMethod>);
44 getParser().addDirectiveHandler(
Directive, Handler);
48 WasmAsmParser() { BracketExpressionsSupported =
true; }
56 addDirectiveHandler<&WasmAsmParser::parseSectionDirectiveText>(
".text");
57 addDirectiveHandler<&WasmAsmParser::parseSectionDirectiveData>(
".data");
58 addDirectiveHandler<&WasmAsmParser::parseSectionDirective>(
".section");
59 addDirectiveHandler<&WasmAsmParser::parseDirectiveSize>(
".size");
60 addDirectiveHandler<&WasmAsmParser::parseDirectiveType>(
".type");
61 addDirectiveHandler<&WasmAsmParser::ParseDirectiveIdent>(
".ident");
63 &WasmAsmParser::ParseDirectiveSymbolAttribute>(
".weak");
65 &WasmAsmParser::ParseDirectiveSymbolAttribute>(
".local");
67 &WasmAsmParser::ParseDirectiveSymbolAttribute>(
".internal");
69 &WasmAsmParser::ParseDirectiveSymbolAttribute>(
".hidden");
77 auto Ok = Lexer->
is(Kind);
85 return error(std::string(
"Expected ") + KindName +
", instead got: ",
96 auto *
S = getContext().getObjectFileInfo()->getDataSection();
97 getStreamer().switchSection(
S);
103 for (
char C : FlagStr) {
126 return TokError(
"expected group name");
129 GroupName = getTok().getString();
132 return TokError(
"invalid group name");
138 return TokError(
"invalid linkage");
139 if (Linkage !=
"comdat")
140 return TokError(
"Linkage must be 'comdat'");
148 return TokError(
"expected identifier in directive");
154 return error(
"expected string in directive, instead got: ", Lexer->
getTok());
171 bool Passive =
false;
176 return TokError(
"unknown flag");
184 if (Group && parseGroup(GroupName))
195 Parser->
Error(loc,
"changed section flags for " + Name +
201 return Parser->
Error(loc,
"Only data sections can be passive");
205 getStreamer().switchSection(WS);
214 return TokError(
"expected identifier in directive");
215 auto Sym = getContext().getOrCreateSymbol(Name);
223 auto WasmSym = cast<MCSymbolWasm>(Sym);
224 if (WasmSym->isFunction()) {
227 Warning(Loc,
".size directive ignored for function symbols");
229 getStreamer().emitELFSize(Sym, Expr);
238 return error(
"Expected label after .type directive, got: ",
240 auto WasmSym = cast<MCSymbolWasm>(
241 getStreamer().getContext().getOrCreateSymbol(
246 return error(
"Expected label,@type declaration, got: ", Lexer->
getTok());
251 cast<MCSectionWasm>(getStreamer().getCurrentSection().first);
252 if (Current->getGroup())
253 WasmSym->setComdat(
true);
259 return error(
"Unknown WASM symbol type: ", Lexer->
getTok());
269 return TokError(
"unexpected token in '.ident' directive");
273 return TokError(
"unexpected token in '.ident' directive");
275 getStreamer().emitIdent(
Data);
294 if (getParser().parseIdentifier(Name))
295 return TokError(
"expected identifier in directive");
296 MCSymbol *Sym = getContext().getOrCreateSymbol(Name);
297 getStreamer().emitSymbolAttribute(Sym, Attr);
301 return TokError(
"unexpected token in directive");
315 return new WasmAsmParser;
StringSwitch & Case(StringLiteral S, T Value)
Generic assembler parser interface, for use by target specific assembly parsers.
should just be implemented with a CLZ instruction Since there are other e that share this it would be best to implement this in a target independent as zero is the default value for the binary encoder e add r0 add r5 Register operands should be distinct That is
This is an optimization pass for GlobalISel generic memory operations.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
static SectionKind getMetadata()
Generic assembler lexer interface, for use by target specific assembly lexers.
This currently compiles esp xmm0 movsd esp eax eax esp ret We should use not the dag combiner This is because dagcombine2 needs to be able to see through the X86ISD::Wrapper which DAGCombine can t really do The code for turning x load into a single vector load is target independent and should be moved to the dag combiner The code for turning x load into a vector load can only handle a direct load from a global or a direct load from the stack It should be generalized to handle any load from P
@ MCSA_Invalid
Not a valid directive.
virtual bool parseIdentifier(StringRef &Res)=0
Parse an identifier or string (as a quoted identifier) and set Res to the identifier contents.
@ WASM_SYMBOL_TYPE_GLOBAL
const AsmToken & getTok() const
Get the current (last) lexed token.
unsigned getSegmentFlags() const
bool is(AsmToken::TokenKind K) const
Check if the current token has kind K.
Target independent representation for an assembler token.
static unsigned parseSectionFlags(const Triple &TT, StringRef flagsStr, bool *UseLastGroup)
static SectionKind getReadOnly()
virtual bool parseExpression(const MCExpr *&Res, SMLoc &EndLoc)=0
Parse an arbitrary expression.
static SectionKind getThreadBSS()
Represents a location in source code.
This represents a section on wasm.
@ GenericSectionID
Pass this value as the UniqueID during section creation to get the generic section with the given nam...
(vector float) vec_cmpeq(*A, *B) C
@ MCSA_Protected
.protected (ELF)
MCAsmParserExtension * createWasmAsmParser()
static SectionKind getBSS()
std::pair< MCAsmParserExtension *, DirectiveHandler > ExtensionDirectiveHandler
@ WASM_SYMBOL_TYPE_FUNCTION
@ MCSA_Hidden
.hidden (ELF)
static SectionKind getText()
static bool isNot(const MachineRegisterInfo &MRI, const MachineInstr &MI)
virtual void Initialize(MCAsmParser &Parser)
Initialize the extension for parsing using the given Parser.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static SectionKind getThreadData()
bool Error(SMLoc L, const Twine &Msg, SMRange Range=std::nullopt)
Return an error at the location L, with the message Msg.
StringRef - Represent a constant reference to a string, i.e.
Generic interface for extending the MCAsmParser, which is implemented by target and object file assem...
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
void setPassive(bool V=true)
Linkage
Describes symbol linkage.
StringRef getString() const
Get the string for the current token, this includes all characters (for example, the quotes on string...
@ MCSA_Internal
.internal (ELF)
const CustomOperand< const MCSubtargetInfo & > Msg[]
static SectionKind getData()
constexpr char TypeName[]
Key for Kernel::Arg::Metadata::mTypeName.
bool isNot(AsmToken::TokenKind K) const
Check if the current token has kind K.
virtual MCAsmLexer & getLexer()=0
A switch()-like statement whose cases are string literals.
Base class for the full range of assembler expressions which are needed for parsing.