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