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"
|
2009-08-23 04:48:53 +08:00
|
|
|
#include "AlphaMCAsmInfo.h"
|
2005-01-23 07:41:55 +08:00
|
|
|
#include "AlphaTargetMachine.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-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-08-23 04:48:53 +08:00
|
|
|
RegisterAsmInfo<AlphaMCAsmInfo> Y(TheAlphaTarget);
|
2006-09-08 07:39:26 +08:00
|
|
|
}
|
|
|
|
|
2009-08-03 07:37:13 +08:00
|
|
|
AlphaTargetMachine::AlphaTargetMachine(const Target &T, const std::string &TT,
|
2009-07-16 04:24:03 +08:00
|
|
|
const std::string &FS)
|
2009-08-12 04:42:37 +08:00
|
|
|
: LLVMTargetMachine(T, TT),
|
2009-11-08 03:07:32 +08:00
|
|
|
DataLayout("e-f128:128:128-n64"),
|
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 07:37:13 +08:00
|
|
|
Subtarget(TT, FS),
|
2010-05-12 01:31:57 +08:00
|
|
|
TLInfo(*this),
|
|
|
|
TSInfo(*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-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;
|
|
|
|
}
|