2005-03-18 02:17:03 +08:00
|
|
|
//===-- IA64TargetMachine.cpp - Define TargetMachine for IA64 -------------===//
|
2005-04-22 07:13:11 +08:00
|
|
|
//
|
2005-03-18 02:17:03 +08:00
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-30 04:36:04 +08:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2005-04-22 07:13:11 +08:00
|
|
|
//
|
2005-03-18 02:17:03 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
2005-04-22 07:13:11 +08:00
|
|
|
//
|
2006-09-04 12:14:57 +08:00
|
|
|
// This file implements the IA64 specific subclass of TargetMachine.
|
2005-03-18 02:17:03 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2006-09-08 07:39:26 +08:00
|
|
|
#include "IA64TargetAsmInfo.h"
|
2005-03-18 02:17:03 +08: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-05-13 08:00:25 +08:00
|
|
|
static RegisterTarget<IA64TargetMachine> X("ia64", " IA-64 (Itanium)");
|
2005-03-18 02:17:03 +08:00
|
|
|
|
2006-09-08 07:39:26 +08:00
|
|
|
const TargetAsmInfo *IA64TargetMachine::createTargetAsmInfo() const {
|
|
|
|
return new IA64TargetAsmInfo(*this);
|
|
|
|
}
|
|
|
|
|
2005-03-18 02:17:03 +08: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-23 01:54:37 +08:00
|
|
|
(TT[1]=='a' || TT[1]=='A') ) {
|
2005-03-18 02:17:03 +08:00
|
|
|
for(unsigned int i=2; i<(TT.size()-1); i++)
|
2005-04-23 01:54:37 +08:00
|
|
|
if(TT[i]=='6' && TT[i+1]=='4')
|
|
|
|
seenIA64=true;
|
2005-03-18 02:17:03 +08:00
|
|
|
}
|
|
|
|
|
2006-08-27 05:33:05 +08:00
|
|
|
if (seenIA64)
|
|
|
|
return 20; // strong match
|
2005-03-18 02:17:03 +08:00
|
|
|
}
|
2007-07-10 01:25:29 +08:00
|
|
|
// If the target triple is something non-ia64, we don't match.
|
|
|
|
if (!TT.empty()) return 0;
|
2005-03-18 02:17:03 +08:00
|
|
|
|
2006-08-27 05:33:05 +08:00
|
|
|
#if defined(__ia64__) || defined(__IA64__)
|
|
|
|
return 5;
|
|
|
|
#else
|
|
|
|
return 0;
|
|
|
|
#endif
|
2005-03-18 02:17:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/// IA64TargetMachine ctor - Create an LP64 architecture model
|
|
|
|
///
|
2006-03-23 13:43:16 +08:00
|
|
|
IA64TargetMachine::IA64TargetMachine(const Module &M, const std::string &FS)
|
2007-08-04 04:20:50 +08:00
|
|
|
: DataLayout("e-f80:128:128"),
|
2006-03-14 07:20:37 +08:00
|
|
|
FrameInfo(TargetFrameInfo::StackGrowsDown, 16, 0),
|
|
|
|
TLInfo(*this) { // FIXME? check this stuff
|
2005-03-18 02:17:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-09-04 12:14:57 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Pass Pipeline Configuration
|
|
|
|
//===----------------------------------------------------------------------===//
|
2005-03-18 02:17:03 +08:00
|
|
|
|
2008-03-12 06:29:46 +08:00
|
|
|
bool IA64TargetMachine::addInstSelector(PassManagerBase &PM, bool Fast) {
|
2006-01-19 22:13:11 +08:00
|
|
|
PM.add(createIA64DAGToDAGInstructionSelector(*this));
|
2006-09-04 12:14:57 +08:00
|
|
|
return false;
|
|
|
|
}
|
2005-03-18 02:17:03 +08:00
|
|
|
|
2008-03-12 06:29:46 +08:00
|
|
|
bool IA64TargetMachine::addPreEmitPass(PassManagerBase &PM, bool Fast) {
|
2006-01-25 10:23:38 +08:00
|
|
|
// Make sure everything is bundled happily
|
|
|
|
PM.add(createIA64BundlingPass(*this));
|
2006-09-04 12:14:57 +08:00
|
|
|
return true;
|
|
|
|
}
|
2008-03-12 06:29:46 +08:00
|
|
|
bool IA64TargetMachine::addAssemblyEmitter(PassManagerBase &PM, bool Fast,
|
2006-09-04 12:14:57 +08:00
|
|
|
std::ostream &Out) {
|
|
|
|
PM.add(createIA64CodePrinterPass(Out, *this));
|
|
|
|
return false;
|
2005-03-18 02:17:03 +08:00
|
|
|
}
|
|
|
|
|