21 MCLFIRewriter *Rewriter;
22 template <
bool (LFIAsmParser::*HandlerMethod)(StringRef, SMLoc)>
23 void addDirectiveHandler(StringRef Directive) {
25 std::make_pair(
this, HandleDirective<LFIAsmParser, HandlerMethod>);
27 getParser().addDirectiveHandler(Directive, Handler);
31 LFIAsmParser(MCLFIRewriter *Exp) : Rewriter(
Exp) {}
32 void Initialize(MCAsmParser &Parser)
override {
35 addDirectiveHandler<&LFIAsmParser::parseRewriteDisable>(
36 ".lfi_rewrite_disable");
37 addDirectiveHandler<&LFIAsmParser::parseRewriteEnable>(
38 ".lfi_rewrite_enable");
42 bool parseRewriteDisable(StringRef Directive, SMLoc Loc) {
43 getParser().checkForValidSection();
45 return TokError(
"unexpected token");
54 bool parseRewriteEnable(StringRef Directive, SMLoc Loc) {
55 getParser().checkForValidSection();
57 return TokError(
"unexpected token");
68 return new LFIAsmParser(Exp);
static bool isNot(const MachineRegisterInfo &MRI, const MachineInstr &MI)
This file declares the MCLFIRewriter class, an abstract class that encapsulates the rewriting logic f...
Generic interface for extending the MCAsmParser, which is implemented by target and object file assem...
virtual void Initialize(MCAsmParser &Parser)
Initialize the extension for parsing using the given Parser.
std::pair< MCAsmParserExtension *, DirectiveHandler > ExtensionDirectiveHandler
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI MCAsmParserExtension * createLFIAsmParser(MCLFIRewriter *Exp)