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"
|
2009-08-23 04:48:53 +08:00
|
|
|
#include "SparcMCAsmInfo.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);
|
|
|
|
|
|
|
|
RegisterAsmInfo<SparcELFMCAsmInfo> A(TheSparcTarget);
|
|
|
|
RegisterAsmInfo<SparcELFMCAsmInfo> B(TheSparcV9Target);
|
2009-06-17 04:12:29 +08:00
|
|
|
|
2006-09-08 07:39:26 +08:00
|
|
|
}
|
|
|
|
|
2006-02-05 13:50:24 +08:00
|
|
|
/// SparcTargetMachine ctor - Create an ILP32 architecture model
|
|
|
|
///
|
2009-08-03 07:37:13 +08:00
|
|
|
SparcTargetMachine::SparcTargetMachine(const Target &T, const std::string &TT,
|
2010-02-04 14:34:01 +08:00
|
|
|
const std::string &FS, bool is64bit)
|
2009-08-12 04:42:37 +08:00
|
|
|
: LLVMTargetMachine(T, TT),
|
2010-02-04 14:34:01 +08:00
|
|
|
Subtarget(TT, FS, is64bit),
|
|
|
|
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,
|
|
|
|
const std::string &TT,
|
|
|
|
const std::string &FS)
|
|
|
|
: SparcTargetMachine(T, TT, FS, false) {
|
|
|
|
}
|
|
|
|
|
|
|
|
SparcV9TargetMachine::SparcV9TargetMachine(const Target &T,
|
|
|
|
const std::string &TT,
|
|
|
|
const std::string &FS)
|
|
|
|
: SparcTargetMachine(T, TT, FS, true) {
|
|
|
|
}
|