From: Anton Korobeynikov Date: Sun, 3 May 2009 13:01:23 +0000 (+0000) Subject: Add 'msp430' target triple recognizer X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=f3085ac973da76bd737d9b88652c0fd0a6097bb2;p=oota-llvm.git Add 'msp430' target triple recognizer git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70708 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/MSP430/MSP430TargetMachine.cpp b/lib/Target/MSP430/MSP430TargetMachine.cpp index cf4464d8aa9..a2dee33c6c9 100644 --- a/lib/Target/MSP430/MSP430TargetMachine.cpp +++ b/lib/Target/MSP430/MSP430TargetMachine.cpp @@ -43,7 +43,6 @@ MSP430TargetMachine::MSP430TargetMachine(const Module &M, InstrInfo(*this), TLInfo(*this), FrameInfo(TargetFrameInfo::StackGrowsUp, 8, 0) { } - const TargetAsmInfo *MSP430TargetMachine::createTargetAsmInfo() const { return new MSP430TargetAsmInfo(*this); } @@ -54,10 +53,22 @@ bool MSP430TargetMachine::addInstSelector(PassManagerBase &PM, bool Fast) { return false; } -bool MSP430TargetMachine:: -addAssemblyEmitter(PassManagerBase &PM, bool Fast, bool Verbose, - raw_ostream &Out) { +bool MSP430TargetMachine::addAssemblyEmitter(PassManagerBase &PM, + bool Fast, bool Verbose, + raw_ostream &Out) { // Output assembly language. PM.add(createMSP430CodePrinterPass(Out, *this, Fast, Verbose)); return false; } + +unsigned MSP430TargetMachine::getModuleMatchQuality(const Module &M) { + std::string TT = M.getTargetTriple(); + + // We strongly match msp430 + if (TT.size() >= 6 && TT[0] == 'm' && TT[1] == 's' && TT[2] == 'p' && + TT[3] == '4' && TT[4] == '3' && TT[5] == '0') + return 20; + + return 0; +} + diff --git a/lib/Target/MSP430/MSP430TargetMachine.h b/lib/Target/MSP430/MSP430TargetMachine.h index edfc8ebed75..258a3951ca1 100644 --- a/lib/Target/MSP430/MSP430TargetMachine.h +++ b/lib/Target/MSP430/MSP430TargetMachine.h @@ -59,6 +59,7 @@ public: virtual bool addInstSelector(PassManagerBase &PM, bool Fast); virtual bool addAssemblyEmitter(PassManagerBase &PM, bool Fast, bool Verbose, raw_ostream &Out); + static unsigned getModuleMatchQuality(const Module &M); }; // MSP430TargetMachine. } // end namespace llvm