2005-01-24 18:45:41 +00:00
|
|
|
//===-- AlphaTargetMachine.cpp - Define TargetMachine for Alpha -----------===//
|
2005-04-21 23:13:11 +00:00
|
|
|
//
|
2005-01-22 23:41:55 +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-01-22 23:41:55 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
2005-04-21 23:13:11 +00:00
|
|
|
//
|
2005-01-22 23:41:55 +00:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "Alpha.h"
|
2005-07-22 20:52:16 +00:00
|
|
|
#include "AlphaJITInfo.h"
|
2006-09-07 23:39:26 +00:00
|
|
|
#include "AlphaTargetAsmInfo.h"
|
2005-01-22 23:41:55 +00:00
|
|
|
#include "AlphaTargetMachine.h"
|
2005-02-01 20:35:11 +00:00
|
|
|
#include "llvm/Module.h"
|
2006-09-04 04:14:57 +00:00
|
|
|
#include "llvm/PassManager.h"
|
2005-01-22 23:41:55 +00:00
|
|
|
#include "llvm/Target/TargetMachineRegistry.h"
|
2009-07-14 20:18:05 +00:00
|
|
|
#include "llvm/Support/FormattedStream.h"
|
2005-02-01 20:35:11 +00:00
|
|
|
|
2005-01-22 23:41:55 +00:00
|
|
|
using namespace llvm;
|
|
|
|
|
2008-05-13 00:00:25 +00:00
|
|
|
// Register the targets
|
2009-07-15 20:24:03 +00:00
|
|
|
static RegisterTarget<AlphaTargetMachine> X(TheAlphaTarget, "alpha",
|
|
|
|
"Alpha [experimental]");
|
2005-01-22 23:41:55 +00:00
|
|
|
|
2009-06-23 23:59:40 +00:00
|
|
|
// Force static initialization.
|
|
|
|
extern "C" void LLVMInitializeAlphaTarget() { }
|
2009-06-16 20:12:29 +00:00
|
|
|
|
2006-09-07 23:39:26 +00:00
|
|
|
const TargetAsmInfo *AlphaTargetMachine::createTargetAsmInfo() const {
|
|
|
|
return new AlphaTargetAsmInfo(*this);
|
|
|
|
}
|
|
|
|
|
2009-07-15 20:24:03 +00:00
|
|
|
AlphaTargetMachine::AlphaTargetMachine(const Target &T, const Module &M,
|
|
|
|
const std::string &FS)
|
|
|
|
: LLVMTargetMachine(T),
|
|
|
|
DataLayout("e-f128:128:128"),
|
2005-08-03 22:33:21 +00:00
|
|
|
FrameInfo(TargetFrameInfo::StackGrowsDown, 16, 0),
|
2005-09-29 22:54:56 +00:00
|
|
|
JITInfo(*this),
|
2006-10-11 04:29:42 +00:00
|
|
|
Subtarget(M, FS),
|
|
|
|
TLInfo(*this) {
|
2006-09-24 19:46:56 +00:00
|
|
|
setRelocationModel(Reloc::PIC_);
|
2005-09-29 22:54:56 +00:00
|
|
|
}
|
2005-01-22 23:41:55 +00:00
|
|
|
|
2005-04-21 23:13:11 +00:00
|
|
|
|
2006-09-04 04:14:57 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Pass Pipeline Configuration
|
|
|
|
//===----------------------------------------------------------------------===//
|
2005-01-22 23:41:55 +00:00
|
|
|
|
2009-04-29 00:15:41 +00:00
|
|
|
bool AlphaTargetMachine::addInstSelector(PassManagerBase &PM,
|
2009-04-29 23:29:43 +00:00
|
|
|
CodeGenOpt::Level OptLevel) {
|
2006-01-23 21:56:07 +00:00
|
|
|
PM.add(createAlphaISelDag(*this));
|
2005-01-22 23:41:55 +00:00
|
|
|
return false;
|
|
|
|
}
|
2009-04-29 00:15:41 +00:00
|
|
|
bool AlphaTargetMachine::addPreEmitPass(PassManagerBase &PM,
|
2009-04-29 23:29:43 +00:00
|
|
|
CodeGenOpt::Level OptLevel) {
|
2005-07-22 20:52:16 +00:00
|
|
|
// Must run branch selection immediately preceding the asm printer
|
2006-10-31 16:49:55 +00:00
|
|
|
PM.add(createAlphaBranchSelectionPass());
|
2009-07-15 21:40:24 +00:00
|
|
|
PM.add(createAlphaLLRPPass(*this));
|
2006-09-04 04:14:57 +00:00
|
|
|
return false;
|
2005-07-22 20:52:16 +00:00
|
|
|
}
|
2009-04-29 23:29:43 +00:00
|
|
|
bool AlphaTargetMachine::addCodeEmitter(PassManagerBase &PM,
|
|
|
|
CodeGenOpt::Level OptLevel,
|
2009-07-15 22:33:19 +00:00
|
|
|
MachineCodeEmitter &MCE) {
|
2006-07-25 20:40:54 +00:00
|
|
|
PM.add(createAlphaCodeEmitterPass(*this, MCE));
|
2005-07-22 20:52:16 +00:00
|
|
|
return false;
|
|
|
|
}
|
2009-05-30 20:51:52 +00:00
|
|
|
bool AlphaTargetMachine::addCodeEmitter(PassManagerBase &PM,
|
|
|
|
CodeGenOpt::Level OptLevel,
|
2009-07-15 22:33:19 +00:00
|
|
|
JITCodeEmitter &JCE) {
|
2009-05-30 20:51:52 +00:00
|
|
|
PM.add(createAlphaJITCodeEmitterPass(*this, JCE));
|
|
|
|
return false;
|
|
|
|
}
|
2009-07-06 05:09:34 +00:00
|
|
|
bool AlphaTargetMachine::addCodeEmitter(PassManagerBase &PM,
|
|
|
|
CodeGenOpt::Level OptLevel,
|
2009-07-15 22:33:19 +00:00
|
|
|
ObjectCodeEmitter &OCE) {
|
2009-07-06 05:09:34 +00:00
|
|
|
PM.add(createAlphaObjectCodeEmitterPass(*this, OCE));
|
|
|
|
return false;
|
|
|
|
}
|
2008-03-11 22:29:46 +00:00
|
|
|
bool AlphaTargetMachine::addSimpleCodeEmitter(PassManagerBase &PM,
|
2009-04-29 23:29:43 +00:00
|
|
|
CodeGenOpt::Level OptLevel,
|
2007-02-08 01:38:33 +00:00
|
|
|
MachineCodeEmitter &MCE) {
|
2009-07-15 22:33:19 +00:00
|
|
|
return addCodeEmitter(PM, OptLevel, MCE);
|
2007-02-08 01:38:33 +00:00
|
|
|
}
|
2009-05-30 20:51:52 +00:00
|
|
|
bool AlphaTargetMachine::addSimpleCodeEmitter(PassManagerBase &PM,
|
|
|
|
CodeGenOpt::Level OptLevel,
|
|
|
|
JITCodeEmitter &JCE) {
|
2009-07-15 22:33:19 +00:00
|
|
|
return addCodeEmitter(PM, OptLevel, JCE);
|
2009-05-30 20:51:52 +00:00
|
|
|
}
|
2009-07-06 05:09:34 +00:00
|
|
|
bool AlphaTargetMachine::addSimpleCodeEmitter(PassManagerBase &PM,
|
|
|
|
CodeGenOpt::Level OptLevel,
|
|
|
|
ObjectCodeEmitter &OCE) {
|
2009-07-15 22:33:19 +00:00
|
|
|
return addCodeEmitter(PM, OptLevel, OCE);
|
2009-07-06 05:09:34 +00:00
|
|
|
}
|
2009-05-30 20:51:52 +00:00
|
|
|
|