Add 'msp430' target triple recognizer

llvm-svn: 70708
This commit is contained in:
Anton Korobeynikov 2009-05-03 13:01:23 +00:00
parent a9b7df98e6
commit ef811d8e05
2 changed files with 16 additions and 4 deletions

View File

@ -43,7 +43,6 @@ MSP430TargetMachine::MSP430TargetMachine(const Module &M,
InstrInfo(*this), TLInfo(*this), InstrInfo(*this), TLInfo(*this),
FrameInfo(TargetFrameInfo::StackGrowsUp, 8, 0) { } FrameInfo(TargetFrameInfo::StackGrowsUp, 8, 0) { }
const TargetAsmInfo *MSP430TargetMachine::createTargetAsmInfo() const { const TargetAsmInfo *MSP430TargetMachine::createTargetAsmInfo() const {
return new MSP430TargetAsmInfo(*this); return new MSP430TargetAsmInfo(*this);
} }
@ -54,10 +53,22 @@ bool MSP430TargetMachine::addInstSelector(PassManagerBase &PM, bool Fast) {
return false; return false;
} }
bool MSP430TargetMachine:: bool MSP430TargetMachine::addAssemblyEmitter(PassManagerBase &PM,
addAssemblyEmitter(PassManagerBase &PM, bool Fast, bool Verbose, bool Fast, bool Verbose,
raw_ostream &Out) { raw_ostream &Out) {
// Output assembly language. // Output assembly language.
PM.add(createMSP430CodePrinterPass(Out, *this, Fast, Verbose)); PM.add(createMSP430CodePrinterPass(Out, *this, Fast, Verbose));
return false; 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;
}

View File

@ -59,6 +59,7 @@ public:
virtual bool addInstSelector(PassManagerBase &PM, bool Fast); virtual bool addInstSelector(PassManagerBase &PM, bool Fast);
virtual bool addAssemblyEmitter(PassManagerBase &PM, bool Fast, virtual bool addAssemblyEmitter(PassManagerBase &PM, bool Fast,
bool Verbose, raw_ostream &Out); bool Verbose, raw_ostream &Out);
static unsigned getModuleMatchQuality(const Module &M);
}; // MSP430TargetMachine. }; // MSP430TargetMachine.
} // end namespace llvm } // end namespace llvm