diff --git a/include/llvm/Target/TargetAsmParser.h b/include/llvm/Target/TargetAsmParser.h index 9ff50cb275b..df84231eea1 100644 --- a/include/llvm/Target/TargetAsmParser.h +++ b/include/llvm/Target/TargetAsmParser.h @@ -15,7 +15,6 @@ namespace llvm { class MCStreamer; class StringRef; -class Target; class SMLoc; class AsmToken; class MCParsedAsmOperand; @@ -26,23 +25,19 @@ class TargetAsmParser : public MCAsmParserExtension { TargetAsmParser(const TargetAsmParser &); // DO NOT IMPLEMENT void operator=(const TargetAsmParser &); // DO NOT IMPLEMENT protected: // Can only create subclasses. - TargetAsmParser(const Target &); + TargetAsmParser(); - /// The Target that this machine was created for. - const Target &TheTarget; - - /// The current set of available features. + /// AvailableFeatures - The current set of available features. unsigned AvailableFeatures; public: virtual ~TargetAsmParser(); - const Target &getTarget() const { return TheTarget; } - unsigned getAvailableFeatures() const { return AvailableFeatures; } void setAvailableFeatures(unsigned Value) { AvailableFeatures = Value; } - virtual bool ParseRegister(unsigned &RegNo, SMLoc &StartLoc, SMLoc &EndLoc) = 0; + virtual bool ParseRegister(unsigned &RegNo, SMLoc &StartLoc, + SMLoc &EndLoc) = 0; /// ParseInstruction - Parse one assembly instruction. /// diff --git a/include/llvm/Target/TargetRegistry.h b/include/llvm/Target/TargetRegistry.h index 00b009a52ef..168670387c8 100644 --- a/include/llvm/Target/TargetRegistry.h +++ b/include/llvm/Target/TargetRegistry.h @@ -79,7 +79,7 @@ namespace llvm { const std::string &TT); typedef TargetAsmLexer *(*AsmLexerCtorTy)(const Target &T, const MCAsmInfo &MAI); - typedef TargetAsmParser *(*AsmParserCtorTy)(const Target &T, StringRef TT, + typedef TargetAsmParser *(*AsmParserCtorTy)(StringRef TT, StringRef CPU, StringRef Features, MCAsmParser &P); typedef MCDisassembler *(*MCDisassemblerCtorTy)(const Target &T); @@ -300,10 +300,11 @@ namespace llvm { /// \arg Parser - The target independent parser implementation to use for /// parsing and lexing. TargetAsmParser *createAsmParser(StringRef Triple, StringRef CPU, - StringRef Features, MCAsmParser &Parser) const { + StringRef Features, + MCAsmParser &Parser) const { if (!AsmParserCtorFn) return 0; - return AsmParserCtorFn(*this, Triple, CPU, Features, Parser); + return AsmParserCtorFn(Triple, CPU, Features, Parser); } /// createAsmPrinter - Create a target specific assembly printer pass. This @@ -858,10 +859,9 @@ namespace llvm { } private: - static TargetAsmParser *Allocator(const Target &T, StringRef TT, - StringRef CPU, StringRef FS, - MCAsmParser &P) { - return new AsmParserImpl(T, TT, CPU, FS, P); + static TargetAsmParser *Allocator(StringRef TT, StringRef CPU, + StringRef FS, MCAsmParser &P) { + return new AsmParserImpl(TT, CPU, FS, P); } }; diff --git a/lib/MC/MCParser/TargetAsmParser.cpp b/lib/MC/MCParser/TargetAsmParser.cpp index 8d43c21f4bc..512f6b04491 100644 --- a/lib/MC/MCParser/TargetAsmParser.cpp +++ b/lib/MC/MCParser/TargetAsmParser.cpp @@ -10,8 +10,8 @@ #include "llvm/Target/TargetAsmParser.h" using namespace llvm; -TargetAsmParser::TargetAsmParser(const Target &T) - : TheTarget(T), AvailableFeatures(0) +TargetAsmParser::TargetAsmParser() + : AvailableFeatures(0) { } diff --git a/lib/Target/ARM/AsmParser/ARMAsmParser.cpp b/lib/Target/ARM/AsmParser/ARMAsmParser.cpp index 5cf3633b430..d97f8a5b769 100644 --- a/lib/Target/ARM/AsmParser/ARMAsmParser.cpp +++ b/lib/Target/ARM/AsmParser/ARMAsmParser.cpp @@ -41,7 +41,7 @@ class ARMOperand; class ARMAsmParser : public TargetAsmParser { MCAsmParser &Parser; - MCSubtargetInfo *STI; + const MCSubtargetInfo *STI; MCAsmParser &getParser() const { return Parser; } MCAsmLexer &getLexer() const { return Parser.getLexer(); } @@ -127,9 +127,8 @@ class ARMAsmParser : public TargetAsmParser { const SmallVectorImpl &); public: - ARMAsmParser(const Target &T, StringRef TT, StringRef CPU, StringRef FS, - MCAsmParser &_Parser) - : TargetAsmParser(T), Parser(_Parser) { + ARMAsmParser(StringRef TT, StringRef CPU, StringRef FS, MCAsmParser &_Parser) + : TargetAsmParser(), Parser(_Parser) { STI = ARM_MC::createARMMCSubtargetInfo(TT, CPU, FS); MCAsmParserExtension::Initialize(_Parser); diff --git a/lib/Target/MBlaze/AsmParser/MBlazeAsmParser.cpp b/lib/Target/MBlaze/AsmParser/MBlazeAsmParser.cpp index 603fc64bb9a..a6fc1474998 100644 --- a/lib/Target/MBlaze/AsmParser/MBlazeAsmParser.cpp +++ b/lib/Target/MBlaze/AsmParser/MBlazeAsmParser.cpp @@ -63,9 +63,9 @@ class MBlazeAsmParser : public TargetAsmParser { public: - MBlazeAsmParser(const Target &T, StringRef TT, StringRef CPU, StringRef FS, + MBlazeAsmParser(StringRef TT, StringRef CPU, StringRef FS, MCAsmParser &_Parser) - : TargetAsmParser(T), Parser(_Parser) {} + : TargetAsmParser(), Parser(_Parser) {} virtual bool ParseInstruction(StringRef Name, SMLoc NameLoc, SmallVectorImpl &Operands); diff --git a/lib/Target/X86/AsmParser/X86AsmParser.cpp b/lib/Target/X86/AsmParser/X86AsmParser.cpp index 45b1944997f..5b66a059722 100644 --- a/lib/Target/X86/AsmParser/X86AsmParser.cpp +++ b/lib/Target/X86/AsmParser/X86AsmParser.cpp @@ -37,7 +37,7 @@ struct X86Operand; class X86ATTAsmParser : public TargetAsmParser { MCAsmParser &Parser; - MCSubtargetInfo *STI; + const MCSubtargetInfo *STI; private: MCAsmParser &getParser() const { return Parser; } @@ -77,9 +77,9 @@ private: /// } public: - X86ATTAsmParser(const Target &T, StringRef TT, StringRef CPU, StringRef FS, + X86ATTAsmParser(StringRef TT, StringRef CPU, StringRef FS, MCAsmParser &parser) - : TargetAsmParser(T), Parser(parser) { + : TargetAsmParser(), Parser(parser) { STI = X86_MC::createX86MCSubtargetInfo(TT, CPU, FS); // Initialize the set of available features.