2006-02-05 06:50:24 +01:00
|
|
|
//===-- SparcTargetMachine.cpp - Define TargetMachine for Sparc -----------===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-29 21:36:04 +01:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2006-02-05 06:50:24 +01:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2010-11-15 01:06:54 +01:00
|
|
|
#include "Sparc.h"
|
2009-08-22 22:48:53 +02:00
|
|
|
#include "SparcMCAsmInfo.h"
|
2006-02-05 06:50:24 +01:00
|
|
|
#include "SparcTargetMachine.h"
|
|
|
|
#include "llvm/PassManager.h"
|
2009-07-25 08:49:55 +02:00
|
|
|
#include "llvm/Target/TargetRegistry.h"
|
2006-02-05 06:50:24 +01:00
|
|
|
using namespace llvm;
|
|
|
|
|
2009-07-25 08:49:55 +02:00
|
|
|
extern "C" void LLVMInitializeSparcTarget() {
|
|
|
|
// Register the target.
|
2010-02-04 07:34:01 +01:00
|
|
|
RegisterTargetMachine<SparcV8TargetMachine> X(TheSparcTarget);
|
|
|
|
RegisterTargetMachine<SparcV9TargetMachine> Y(TheSparcV9Target);
|
|
|
|
|
|
|
|
RegisterAsmInfo<SparcELFMCAsmInfo> A(TheSparcTarget);
|
|
|
|
RegisterAsmInfo<SparcELFMCAsmInfo> B(TheSparcV9Target);
|
2009-06-16 22:12:29 +02:00
|
|
|
|
2006-09-08 01:39:26 +02:00
|
|
|
}
|
|
|
|
|
2006-02-05 06:50:24 +01:00
|
|
|
/// SparcTargetMachine ctor - Create an ILP32 architecture model
|
|
|
|
///
|
2009-08-03 01:37:13 +02:00
|
|
|
SparcTargetMachine::SparcTargetMachine(const Target &T, const std::string &TT,
|
2010-02-04 07:34:01 +01:00
|
|
|
const std::string &FS, bool is64bit)
|
2009-08-11 22:42:37 +02:00
|
|
|
: LLVMTargetMachine(T, TT),
|
2010-02-04 07:34:01 +01:00
|
|
|
Subtarget(TT, FS, is64bit),
|
|
|
|
DataLayout(Subtarget.getDataLayout()),
|
2010-11-15 01:06:54 +01:00
|
|
|
TLInfo(*this), TSInfo(*this), InstrInfo(Subtarget),
|
|
|
|
FrameInfo(Subtarget) {
|
2006-02-05 06:50:24 +01:00
|
|
|
}
|
|
|
|
|
2009-04-29 02:15:41 +02:00
|
|
|
bool SparcTargetMachine::addInstSelector(PassManagerBase &PM,
|
2009-04-30 01:29:43 +02:00
|
|
|
CodeGenOpt::Level OptLevel) {
|
2006-02-05 06:50:24 +01:00
|
|
|
PM.add(createSparcISelDag(*this));
|
2006-09-04 06:14:57 +02:00
|
|
|
return false;
|
|
|
|
}
|
2006-02-05 06:50:24 +01:00
|
|
|
|
2006-09-04 06:14:57 +02: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 01:29:43 +02:00
|
|
|
bool SparcTargetMachine::addPreEmitPass(PassManagerBase &PM,
|
|
|
|
CodeGenOpt::Level OptLevel){
|
2006-02-05 06:50:24 +01:00
|
|
|
PM.add(createSparcFPMoverPass(*this));
|
|
|
|
PM.add(createSparcDelaySlotFillerPass(*this));
|
2006-09-04 06:14:57 +02:00
|
|
|
return true;
|
|
|
|
}
|
2010-02-04 07:34:01 +01: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) {
|
|
|
|
}
|