From ebdeeab812beec0385b445f3d4c41a114e0d972f Mon Sep 17 00:00:00 2001 From: Evan Cheng Date: Fri, 8 Jul 2011 01:53:10 +0000 Subject: Eliminate asm parser's dependency on TargetMachine: - Each target asm parser now creates its own MCSubtatgetInfo (if needed). - Changed AssemblerPredicate to take subtarget features which tablegen uses to generate asm matcher subtarget feature queries. e.g. "ModeThumb,FeatureThumb2" is translated to "(Bits & ModeThumb) != 0 && (Bits & FeatureThumb2) != 0". git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134678 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/MC/MCDisassembler/EDDisassembler.cpp | 10 ++++++---- lib/MC/MCDisassembler/EDDisassembler.h | 1 + 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'lib/MC/MCDisassembler') diff --git a/lib/MC/MCDisassembler/EDDisassembler.cpp b/lib/MC/MCDisassembler/EDDisassembler.cpp index 7f9fcc3..a39f002 100644 --- a/lib/MC/MCDisassembler/EDDisassembler.cpp +++ b/lib/MC/MCDisassembler/EDDisassembler.cpp @@ -171,7 +171,7 @@ EDDisassembler::EDDisassembler(CPUKey &key) : std::string featureString; TargetMachine.reset(Tgt->createTargetMachine(tripleString, CPU, featureString)); - + const TargetRegisterInfo *registerInfo = TargetMachine->getRegisterInfo(); if (!registerInfo) @@ -183,7 +183,7 @@ EDDisassembler::EDDisassembler(CPUKey &key) : if (!AsmInfo) return; - + Disassembler.reset(Tgt->createMCDisassembler()); if (!Disassembler) @@ -371,8 +371,10 @@ int EDDisassembler::parseInst(SmallVectorImpl &operands, OwningPtr genericParser(createMCAsmParser(*Tgt, sourceMgr, context, *streamer, *AsmInfo)); - OwningPtr TargetParser(Tgt->createAsmParser(*genericParser, - *TargetMachine)); + + StringRef triple = tripleFromArch(Key.Arch); + OwningPtr TargetParser(Tgt->createAsmParser(triple, "", "", + *genericParser)); AsmToken OpcodeToken = genericParser->Lex(); AsmToken NextToken = genericParser->Lex(); // consume next token, because specificParser expects us to diff --git a/lib/MC/MCDisassembler/EDDisassembler.h b/lib/MC/MCDisassembler/EDDisassembler.h index 2fcc09d..11d69c1 100644 --- a/lib/MC/MCDisassembler/EDDisassembler.h +++ b/lib/MC/MCDisassembler/EDDisassembler.h @@ -41,6 +41,7 @@ class MCInstPrinter; class MCInst; class MCParsedAsmOperand; class MCStreamer; +class MCSubtargetInfo; template class SmallVectorImpl; class SourceMgr; class Target; -- cgit v1.1