2005-03-17 18:17:03 +00:00
|
|
|
//===-- IA64TargetMachine.cpp - Define TargetMachine for IA64 -------------===//
|
2005-04-21 23:13:11 +00:00
|
|
|
//
|
2005-03-17 18:17:03 +00:00
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-29 20:36:04 +00:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2005-04-21 23:13:11 +00:00
|
|
|
//
|
2005-03-17 18:17:03 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
2005-04-21 23:13:11 +00:00
|
|
|
//
|
2006-09-04 04:14:57 +00:00
|
|
|
// This file implements the IA64 specific subclass of TargetMachine.
|
2005-03-17 18:17:03 +00:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2006-09-07 23:39:26 +00:00
|
|
|
#include "IA64TargetAsmInfo.h"
|
2005-03-17 18:17:03 +00:00
|
|
|
#include "IA64TargetMachine.h"
|
|
|
|
#include "IA64.h"
|
|
|
|
#include "llvm/Module.h"
|
|
|
|
#include "llvm/PassManager.h"
|
|
|
|
#include "llvm/Target/TargetMachineRegistry.h"
|
|
|
|
using namespace llvm;
|
|
|
|
|
|
|
|
/// IA64TargetMachineModule - Note that this is used on hosts that cannot link
|
|
|
|
/// in a library unless there are references into the library. In particular,
|
|
|
|
/// it seems that it is not possible to get things to work on Win32 without
|
|
|
|
/// this. Though it is unused, do not remove it.
|
|
|
|
extern "C" int IA64TargetMachineModule;
|
|
|
|
int IA64TargetMachineModule = 0;
|
|
|
|
|
2008-10-16 06:16:50 +00:00
|
|
|
static RegisterTarget<IA64TargetMachine> X("ia64",
|
|
|
|
"IA-64 (Itanium) [experimental]");
|
2005-03-17 18:17:03 +00:00
|
|
|
|
2006-09-07 23:39:26 +00:00
|
|
|
const TargetAsmInfo *IA64TargetMachine::createTargetAsmInfo() const {
|
|
|
|
return new IA64TargetAsmInfo(*this);
|
|
|
|
}
|
|
|
|
|
2005-03-17 18:17:03 +00:00
|
|
|
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') &&
|
2005-04-22 17:54:37 +00:00
|
|
|
(TT[1]=='a' || TT[1]=='A') ) {
|
2005-03-17 18:17:03 +00:00
|
|
|
for(unsigned int i=2; i<(TT.size()-1); i++)
|
2005-04-22 17:54:37 +00:00
|
|
|
if(TT[i]=='6' && TT[i+1]=='4')
|
|
|
|
seenIA64=true;
|
2005-03-17 18:17:03 +00:00
|
|
|
}
|
|
|
|
|
2006-08-26 21:33:05 +00:00
|
|
|
if (seenIA64)
|
|
|
|
return 20; // strong match
|
2005-03-17 18:17:03 +00:00
|
|
|
}
|
2007-07-09 17:25:29 +00:00
|
|
|
// If the target triple is something non-ia64, we don't match.
|
|
|
|
if (!TT.empty()) return 0;
|
2005-03-17 18:17:03 +00:00
|
|
|
|
2006-08-26 21:33:05 +00:00
|
|
|
#if defined(__ia64__) || defined(__IA64__)
|
|
|
|
return 5;
|
|
|
|
#else
|
|
|
|
return 0;
|
|
|
|
#endif
|
2005-03-17 18:17:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/// IA64TargetMachine ctor - Create an LP64 architecture model
|
|
|
|
///
|
2006-03-23 05:43:16 +00:00
|
|
|
IA64TargetMachine::IA64TargetMachine(const Module &M, const std::string &FS)
|
2007-08-03 20:20:50 +00:00
|
|
|
: DataLayout("e-f80:128:128"),
|
2006-03-13 23:20:37 +00:00
|
|
|
FrameInfo(TargetFrameInfo::StackGrowsDown, 16, 0),
|
|
|
|
TLInfo(*this) { // FIXME? check this stuff
|
2005-03-17 18:17:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-09-04 04:14:57 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Pass Pipeline Configuration
|
|
|
|
//===----------------------------------------------------------------------===//
|
2005-03-17 18:17:03 +00:00
|
|
|
|
2009-04-29 23:29:43 +00:00
|
|
|
bool IA64TargetMachine::addInstSelector(PassManagerBase &PM,
|
|
|
|
CodeGenOpt::Level OptLevel){
|
2006-01-19 14:13:11 +00:00
|
|
|
PM.add(createIA64DAGToDAGInstructionSelector(*this));
|
2006-09-04 04:14:57 +00:00
|
|
|
return false;
|
|
|
|
}
|
2005-03-17 18:17:03 +00:00
|
|
|
|
2009-04-29 23:29:43 +00:00
|
|
|
bool IA64TargetMachine::addPreEmitPass(PassManagerBase &PM,
|
|
|
|
CodeGenOpt::Level OptLevel) {
|
2006-01-25 02:23:38 +00:00
|
|
|
// Make sure everything is bundled happily
|
|
|
|
PM.add(createIA64BundlingPass(*this));
|
2006-09-04 04:14:57 +00:00
|
|
|
return true;
|
|
|
|
}
|
2009-04-29 00:15:41 +00:00
|
|
|
bool IA64TargetMachine::addAssemblyEmitter(PassManagerBase &PM,
|
2009-04-29 23:29:43 +00:00
|
|
|
CodeGenOpt::Level OptLevel,
|
2009-04-29 00:15:41 +00:00
|
|
|
bool Verbose,
|
|
|
|
raw_ostream &Out) {
|
|
|
|
PM.add(createIA64CodePrinterPass(Out, *this, OptLevel, Verbose));
|
2006-09-04 04:14:57 +00:00
|
|
|
return false;
|
2005-03-17 18:17:03 +00:00
|
|
|
}
|
|
|
|
|