forked from OSchip/llvm-project
MC: Pass the target instance to the AsmParser constructor.
llvm-svn: 107426
This commit is contained in:
parent
96278c19fb
commit
02877d6e85
|
@ -36,11 +36,14 @@ class TargetAsmParser;
|
|||
class Twine;
|
||||
|
||||
class AsmParser : public MCAsmParser {
|
||||
AsmParser(const AsmParser &); // DO NOT IMPLEMENT
|
||||
void operator=(const AsmParser &); // DO NOT IMPLEMENT
|
||||
private:
|
||||
AsmLexer Lexer;
|
||||
MCContext &Ctx;
|
||||
MCStreamer &Out;
|
||||
SourceMgr &SrcMgr;
|
||||
TargetAsmParser *GenericTargetParser;
|
||||
TargetAsmParser *TargetParser;
|
||||
|
||||
/// This is the current buffer index we're lexing from as managed by the
|
||||
|
@ -56,7 +59,7 @@ private:
|
|||
/// in the directive name and the location of the directive keyword.
|
||||
StringMap<bool(AsmParser::*)(StringRef, SMLoc)> DirectiveMap;
|
||||
public:
|
||||
AsmParser(SourceMgr &SM, MCContext &Ctx, MCStreamer &Out,
|
||||
AsmParser(const Target &T, SourceMgr &SM, MCContext &Ctx, MCStreamer &Out,
|
||||
const MCAsmInfo &MAI);
|
||||
~AsmParser();
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ void AsmPrinter::EmitInlineAsm(StringRef Str, unsigned LocCookie) const {
|
|||
// Tell SrcMgr about this buffer, it takes ownership of the buffer.
|
||||
SrcMgr.AddNewSourceBuffer(Buffer, SMLoc());
|
||||
|
||||
AsmParser Parser(SrcMgr, OutContext, OutStreamer, *MAI);
|
||||
AsmParser Parser(TM.getTarget(), SrcMgr, OutContext, OutStreamer, *MAI);
|
||||
OwningPtr<TargetAsmParser> TAP(TM.getTarget().createAsmParser(Parser));
|
||||
if (!TAP)
|
||||
report_fatal_error("Inline asm not supported by this streamer because"
|
||||
|
|
|
@ -32,10 +32,9 @@ using namespace llvm;
|
|||
|
||||
enum { DEFAULT_ADDRSPACE = 0 };
|
||||
|
||||
AsmParser::AsmParser(SourceMgr &_SM, MCContext &_Ctx, MCStreamer &_Out,
|
||||
const MCAsmInfo &_MAI)
|
||||
: Lexer(_MAI), Ctx(_Ctx), Out(_Out), SrcMgr(_SM), TargetParser(0),
|
||||
CurBuffer(0) {
|
||||
AsmParser::AsmParser(const Target &T, SourceMgr &_SM, MCContext &_Ctx,
|
||||
MCStreamer &_Out, const MCAsmInfo &_MAI)
|
||||
: Lexer(_MAI), Ctx(_Ctx), Out(_Out), SrcMgr(_SM), CurBuffer(0) {
|
||||
Lexer.setBuffer(SrcMgr.getMemoryBuffer(CurBuffer));
|
||||
|
||||
// Debugging directives.
|
||||
|
@ -44,8 +43,6 @@ AsmParser::AsmParser(SourceMgr &_SM, MCContext &_Ctx, MCStreamer &_Out,
|
|||
AddDirectiveHandler(".loc", &AsmParser::ParseDirectiveLoc);
|
||||
}
|
||||
|
||||
|
||||
|
||||
AsmParser::~AsmParser() {
|
||||
}
|
||||
|
||||
|
|
|
@ -364,7 +364,7 @@ int EDDisassembler::parseInst(SmallVectorImpl<MCParsedAsmOperand*> &operands,
|
|||
sourceMgr.AddNewSourceBuffer(buf, SMLoc()); // ownership of buf handed over
|
||||
MCContext context(*AsmInfo);
|
||||
OwningPtr<MCStreamer> streamer(createNullStreamer(context));
|
||||
AsmParser genericParser(sourceMgr, context, *streamer, *AsmInfo);
|
||||
AsmParser genericParser(*Tgt, sourceMgr, context, *streamer, *AsmInfo);
|
||||
OwningPtr<TargetAsmParser> TargetParser(Tgt->createAsmParser(genericParser));
|
||||
|
||||
AsmToken OpcodeToken = genericParser.Lex();
|
||||
|
|
|
@ -312,7 +312,7 @@ static int AssembleInput(const char *ProgName) {
|
|||
Str.reset(createLoggingStreamer(Str.take(), errs()));
|
||||
}
|
||||
|
||||
AsmParser Parser(SrcMgr, Ctx, *Str.get(), *MAI);
|
||||
AsmParser Parser(*TheTarget, SrcMgr, Ctx, *Str.get(), *MAI);
|
||||
OwningPtr<TargetAsmParser> TAP(TheTarget->createAsmParser(Parser));
|
||||
if (!TAP) {
|
||||
errs() << ProgName
|
||||
|
|
Loading…
Reference in New Issue