diff options
Diffstat (limited to 'llvm/lib/Target/IA64')
-rw-r--r-- | llvm/lib/Target/IA64/AsmPrinter/IA64AsmPrinter.cpp | 8 | ||||
-rw-r--r-- | llvm/lib/Target/IA64/IA64.h | 2 | ||||
-rw-r--r-- | llvm/lib/Target/IA64/IA64TargetMachine.cpp | 35 | ||||
-rw-r--r-- | llvm/lib/Target/IA64/IA64TargetMachine.h | 6 |
4 files changed, 36 insertions, 15 deletions
diff --git a/llvm/lib/Target/IA64/AsmPrinter/IA64AsmPrinter.cpp b/llvm/lib/Target/IA64/AsmPrinter/IA64AsmPrinter.cpp index e5eedad328d..b8aa37ecb70 100644 --- a/llvm/lib/Target/IA64/AsmPrinter/IA64AsmPrinter.cpp +++ b/llvm/lib/Target/IA64/AsmPrinter/IA64AsmPrinter.cpp @@ -26,7 +26,6 @@ #include "llvm/CodeGen/DwarfWriter.h" #include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/Target/TargetAsmInfo.h" -#include "llvm/Target/TargetRegistry.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/FormattedStream.h" #include "llvm/Support/Mangler.h" @@ -370,7 +369,7 @@ bool IA64AsmPrinter::doFinalization(Module &M) { /// the given target machine description. /// FunctionPass *llvm::createIA64CodePrinterPass(formatted_raw_ostream &o, - TargetMachine &tm, + IA64TargetMachine &tm, bool verbose) { return new IA64AsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose); } @@ -385,7 +384,4 @@ namespace { // Force static initialization. -extern "C" void LLVMInitializeIA64AsmPrinter() { - extern Target TheIA64Target; - TargetRegistry::RegisterAsmPrinter(TheIA64Target, createIA64CodePrinterPass); -} +extern "C" void LLVMInitializeIA64AsmPrinter() { } diff --git a/llvm/lib/Target/IA64/IA64.h b/llvm/lib/Target/IA64/IA64.h index e45aedaa731..afcbdaf4d11 100644 --- a/llvm/lib/Target/IA64/IA64.h +++ b/llvm/lib/Target/IA64/IA64.h @@ -38,7 +38,7 @@ FunctionPass *createIA64BundlingPass(IA64TargetMachine &TM); /// regardless of whether the function is in SSA form. /// FunctionPass *createIA64CodePrinterPass(formatted_raw_ostream &o, - TargetMachine &tm, + IA64TargetMachine &tm, bool verbose); } // End llvm namespace diff --git a/llvm/lib/Target/IA64/IA64TargetMachine.cpp b/llvm/lib/Target/IA64/IA64TargetMachine.cpp index 5355075f8b3..00fdd5e8a65 100644 --- a/llvm/lib/Target/IA64/IA64TargetMachine.cpp +++ b/llvm/lib/Target/IA64/IA64TargetMachine.cpp @@ -20,8 +20,7 @@ using namespace llvm; // Register the target -extern Target TheIA64Target; -static RegisterTarget<IA64TargetMachine> X(TheIA64Target, "ia64", +static RegisterTarget<IA64TargetMachine> X("ia64", "IA-64 (Itanium) [experimental]"); // No assembler printer by default @@ -34,12 +33,36 @@ const TargetAsmInfo *IA64TargetMachine::createTargetAsmInfo() const { return new IA64TargetAsmInfo(*this); } +unsigned IA64TargetMachine::getModuleMatchQuality(const Module &M) { + // we match [iI][aA]*64 + bool seenIA64=false; + std::string TT = M.getTargetTriple(); + + if (TT.size() >= 4) { + if( (TT[0]=='i' || TT[0]=='I') && + (TT[1]=='a' || TT[1]=='A') ) { + for(unsigned int i=2; i<(TT.size()-1); i++) + if(TT[i]=='6' && TT[i+1]=='4') + seenIA64=true; + } + + if (seenIA64) + return 20; // strong match + } + // If the target triple is something non-ia64, we don't match. + if (!TT.empty()) return 0; + +#if defined(__ia64__) || defined(__IA64__) + return 5; +#else + return 0; +#endif +} + /// IA64TargetMachine ctor - Create an LP64 architecture model /// -IA64TargetMachine::IA64TargetMachine(const Target &T, const Module &M, - const std::string &FS) - : LLVMTargetMachine(T), - DataLayout("e-f80:128:128"), +IA64TargetMachine::IA64TargetMachine(const Module &M, const std::string &FS) + : DataLayout("e-f80:128:128"), FrameInfo(TargetFrameInfo::StackGrowsDown, 16, 0), TLInfo(*this) { // FIXME? check this stuff } diff --git a/llvm/lib/Target/IA64/IA64TargetMachine.h b/llvm/lib/Target/IA64/IA64TargetMachine.h index e82bf59c964..8340052f2c0 100644 --- a/llvm/lib/Target/IA64/IA64TargetMachine.h +++ b/llvm/lib/Target/IA64/IA64TargetMachine.h @@ -37,12 +37,12 @@ protected: // To avoid having target depend on the asmprinter stuff libraries, asmprinter // set this functions to ctor pointer at startup time if they are linked in. typedef FunctionPass *(*AsmPrinterCtorFn)(formatted_raw_ostream &o, - TargetMachine &tm, + IA64TargetMachine &tm, bool verbose); static AsmPrinterCtorFn AsmPrinterCtor; public: - IA64TargetMachine(const Target &T, const Module &M, const std::string &FS); + IA64TargetMachine(const Module &M, const std::string &FS); virtual const IA64InstrInfo *getInstrInfo() const { return &InstrInfo; } virtual const TargetFrameInfo *getFrameInfo() const { return &FrameInfo; } @@ -55,6 +55,8 @@ public: } virtual const TargetData *getTargetData() const { return &DataLayout; } + static unsigned getModuleMatchQuality(const Module &M); + // Pass Pipeline Configuration virtual bool addInstSelector(PassManagerBase &PM, CodeGenOpt::Level OptLevel); virtual bool addPreEmitPass(PassManagerBase &PM, CodeGenOpt::Level OptLevel); |