LLVM  14.0.0git
XCOFFAsmParser.cpp
Go to the documentation of this file.
1 //===- XCOFFAsmParser.cpp - XCOFF Assembly Parser
2 //-----------------------------===//
3 //
4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //
8 //===----------------------------------------------------------------------===//
9 
11 #include "llvm/MC/MCContext.h"
15 #include "llvm/MC/MCSectionXCOFF.h"
16 #include "llvm/MC/MCStreamer.h"
17 #include "llvm/MC/MCSymbol.h"
18 #include "llvm/MC/MCSymbolXCOFF.h"
20 
21 using namespace llvm;
22 
23 namespace {
24 
25 class XCOFFAsmParser : public MCAsmParserExtension {
26  MCAsmParser *Parser = nullptr;
27  MCAsmLexer *Lexer = nullptr;
28 
29  template <bool (XCOFFAsmParser::*HandlerMethod)(StringRef, SMLoc)>
30  void addDirectiveHandler(StringRef Directive) {
32  std::make_pair(this, HandleDirective<XCOFFAsmParser, HandlerMethod>);
33 
34  getParser().addDirectiveHandler(Directive, Handler);
35  }
36 
37 public:
38  XCOFFAsmParser() {}
39 
40  void Initialize(MCAsmParser &P) override {
41  Parser = &P;
42  Lexer = &Parser->getLexer();
43  // Call the base implementation.
45 
46  addDirectiveHandler<&XCOFFAsmParser::ParseDirectiveCSect>(".csect");
47  }
48  bool ParseDirectiveCSect(StringRef, SMLoc);
49 };
50 
51 } // end anonymous namespace
52 
53 namespace llvm {
54 
55 MCAsmParserExtension *createXCOFFAsmParser() { return new XCOFFAsmParser; }
56 
57 } // end namespace llvm
58 
59 // .csect QualName [, Number ]
60 bool XCOFFAsmParser::ParseDirectiveCSect(StringRef, SMLoc) {
61  report_fatal_error("XCOFFAsmParser directive not yet supported!");
62  return false;
63 }
llvm::MCAsmParser
Generic assembler parser interface, for use by target specific assembly parsers.
Definition: MCAsmParser.h:124
llvm
This file implements support for optimizing divisions by a constant.
Definition: AllocatorList.h:23
llvm::MCAsmLexer
Generic assembler lexer interface, for use by target specific assembly lexers.
Definition: MCAsmLexer.h:39
P
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
Definition: README-SSE.txt:411
MCAsmParser.h
MachineValueType.h
XCOFF.h
llvm::SMLoc
Represents a location in source code.
Definition: SMLoc.h:23
MCContext.h
MCSymbol.h
llvm::MCAsmParser::ExtensionDirectiveHandler
std::pair< MCAsmParserExtension *, DirectiveHandler > ExtensionDirectiveHandler
Definition: MCAsmParser.h:128
llvm::report_fatal_error
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
Definition: Error.cpp:140
MCSectionXCOFF.h
MCAsmLexer.h
llvm::MCAsmParserExtension::Initialize
virtual void Initialize(MCAsmParser &Parser)
Initialize the extension for parsing using the given Parser.
Definition: MCAsmParserExtension.cpp:19
MCSymbolXCOFF.h
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
llvm::MCAsmParserExtension
Generic interface for extending the MCAsmParser, which is implemented by target and object file assem...
Definition: MCAsmParserExtension.h:25
MCAsmParserExtension.h
llvm::createXCOFFAsmParser
MCAsmParserExtension * createXCOFFAsmParser()
Definition: XCOFFAsmParser.cpp:55
llvm::MCAsmParser::getLexer
virtual MCAsmLexer & getLexer()=0
MCStreamer.h
llvm::Directive
Definition: DirectiveEmitter.h:100