2006-02-05 13:50:24 +08:00
|
|
|
//===-- SparcTargetMachine.cpp - Define TargetMachine for Sparc -----------===//
|
|
|
|
//
|
|
|
|
// 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.
|
2006-02-05 13:50:24 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2010-11-15 08:06:54 +08:00
|
|
|
#include "Sparc.h"
|
2006-02-05 13:50:24 +08:00
|
|
|
#include "SparcTargetMachine.h"
|
|
|
|
#include "llvm/PassManager.h"
|
2009-07-25 14:49:55 +08:00
|
|
|
#include "llvm/Target/TargetRegistry.h"
|
2006-02-05 13:50:24 +08:00
|
|
|
using namespace llvm;
|
|
|
|
|
2009-07-25 14:49:55 +08:00
|
|
|
extern "C" void LLVMInitializeSparcTarget() {
|
|
|
|
// Register the target.
|
2010-02-04 14:34:01 +08:00
|
|
|
RegisterTargetMachine<SparcV8TargetMachine> X(TheSparcTarget);
|
|
|
|
RegisterTargetMachine<SparcV9TargetMachine> Y(TheSparcV9Target);
|
2006-09-08 07:39:26 +08:00
|
|
|
}
|
|
|
|
|
2006-02-05 13:50:24 +08:00
|
|
|
/// SparcTargetMachine ctor - Create an ILP32 architecture model
|
|
|
|
///
|
2011-07-19 14:37:02 +08:00
|
|
|
SparcTargetMachine::SparcTargetMachine(const Target &T, StringRef TT,
|
|
|
|
StringRef CPU, StringRef FS,
|
2011-07-20 15:51:56 +08:00
|
|
|
Reloc::Model RM, CodeModel::Model CM,
|
|
|
|
bool is64bit)
|
|
|
|
: LLVMTargetMachine(T, TT, CPU, FS, RM, CM),
|
2011-06-30 09:53:36 +08:00
|
|
|
Subtarget(TT, CPU, FS, is64bit),
|
2010-02-04 14:34:01 +08:00
|
|
|
DataLayout(Subtarget.getDataLayout()),
|
2010-11-15 08:06:54 +08:00
|
|
|
TLInfo(*this), TSInfo(*this), InstrInfo(Subtarget),
|
2011-01-10 20:39:04 +08:00
|
|
|
FrameLowering(Subtarget) {
|
2006-02-05 13:50:24 +08:00
|
|
|
}
|
|
|
|
|
2009-04-29 08:15:41 +08:00
|
|
|
bool SparcTargetMachine::addInstSelector(PassManagerBase &PM,
|
2009-04-30 07:29:43 +08:00
|
|
|
CodeGenOpt::Level OptLevel) {
|
2006-02-05 13:50:24 +08:00
|
|
|
PM.add(createSparcISelDag(*this));
|
2006-09-04 12:14:57 +08:00
|
|
|
return false;
|
|
|
|
}
|
2006-02-05 13:50:24 +08:00
|
|
|
|
2006-09-04 12:14:57 +08:00
|
|
|
/// addPreEmitPass - This pass may be implemented by targets that want to run
|
|
|
|
/// passes immediately before machine code is emitted. This should return
|
|
|
|
/// true if -print-machineinstrs should print out the code after the passes.
|
2009-04-30 07:29:43 +08:00
|
|
|
bool SparcTargetMachine::addPreEmitPass(PassManagerBase &PM,
|
|
|
|
CodeGenOpt::Level OptLevel){
|
2006-02-05 13:50:24 +08:00
|
|
|
PM.add(createSparcFPMoverPass(*this));
|
|
|
|
PM.add(createSparcDelaySlotFillerPass(*this));
|
2006-09-04 12:14:57 +08:00
|
|
|
return true;
|
|
|
|
}
|
2010-02-04 14:34:01 +08:00
|
|
|
|
|
|
|
SparcV8TargetMachine::SparcV8TargetMachine(const Target &T,
|
2011-07-20 15:51:56 +08:00
|
|
|
StringRef TT, StringRef CPU,
|
|
|
|
StringRef FS, Reloc::Model RM,
|
|
|
|
CodeModel::Model CM)
|
|
|
|
: SparcTargetMachine(T, TT, CPU, FS, RM, CM, false) {
|
2010-02-04 14:34:01 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
SparcV9TargetMachine::SparcV9TargetMachine(const Target &T,
|
2011-07-20 15:51:56 +08:00
|
|
|
StringRef TT, StringRef CPU,
|
|
|
|
StringRef FS, Reloc::Model RM,
|
|
|
|
CodeModel::Model CM)
|
|
|
|
: SparcTargetMachine(T, TT, CPU, FS, RM, CM, true) {
|
2010-02-04 14:34:01 +08:00
|
|
|
}
|