2006-02-05 05:50:24 +00:00
|
|
|
//===-- SparcTargetMachine.cpp - Define TargetMachine for Sparc -----------===//
|
2005-04-21 23:30:14 +00:00
|
|
|
//
|
2004-02-25 19:28:19 +00:00
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-29 20:36:04 +00:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2005-04-21 23:30:14 +00:00
|
|
|
//
|
2004-02-25 19:28:19 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
2005-04-21 23:30:14 +00:00
|
|
|
//
|
2004-02-25 19:28:19 +00:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2010-11-15 00:06:54 +00:00
|
|
|
#include "Sparc.h"
|
2006-02-05 05:50:24 +00:00
|
|
|
#include "SparcTargetMachine.h"
|
2004-02-25 19:28:19 +00:00
|
|
|
#include "llvm/PassManager.h"
|
2011-08-24 18:08:43 +00:00
|
|
|
#include "llvm/Support/TargetRegistry.h"
|
2004-02-28 19:52:49 +00:00
|
|
|
using namespace llvm;
|
2004-02-25 19:28:19 +00:00
|
|
|
|
2009-07-25 06:49:55 +00:00
|
|
|
extern "C" void LLVMInitializeSparcTarget() {
|
|
|
|
// Register the target.
|
2010-02-04 06:34:01 +00:00
|
|
|
RegisterTargetMachine<SparcV8TargetMachine> X(TheSparcTarget);
|
|
|
|
RegisterTargetMachine<SparcV9TargetMachine> Y(TheSparcV9Target);
|
2006-09-07 23:39:26 +00:00
|
|
|
}
|
|
|
|
|
2006-02-05 05:50:24 +00:00
|
|
|
/// SparcTargetMachine ctor - Create an ILP32 architecture model
|
2004-02-25 19:28:19 +00:00
|
|
|
///
|
2011-07-19 06:37:02 +00:00
|
|
|
SparcTargetMachine::SparcTargetMachine(const Target &T, StringRef TT,
|
|
|
|
StringRef CPU, StringRef FS,
|
2011-12-02 22:16:29 +00:00
|
|
|
const TargetOptions &Options,
|
2011-07-20 07:51:56 +00:00
|
|
|
Reloc::Model RM, CodeModel::Model CM,
|
2011-11-16 08:38:26 +00:00
|
|
|
CodeGenOpt::Level OL,
|
2011-07-20 07:51:56 +00:00
|
|
|
bool is64bit)
|
2011-12-02 22:16:29 +00:00
|
|
|
: LLVMTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL),
|
2011-06-30 01:53:36 +00:00
|
|
|
Subtarget(TT, CPU, FS, is64bit),
|
2010-02-04 06:34:01 +00:00
|
|
|
DataLayout(Subtarget.getDataLayout()),
|
2010-11-15 00:06:54 +00:00
|
|
|
TLInfo(*this), TSInfo(*this), InstrInfo(Subtarget),
|
2011-01-10 12:39:04 +00:00
|
|
|
FrameLowering(Subtarget) {
|
2004-10-09 05:57:01 +00:00
|
|
|
}
|
|
|
|
|
2011-11-16 08:38:26 +00:00
|
|
|
bool SparcTargetMachine::addInstSelector(PassManagerBase &PM) {
|
2006-02-05 05:50:24 +00:00
|
|
|
PM.add(createSparcISelDag(*this));
|
2006-09-04 04:14:57 +00:00
|
|
|
return false;
|
|
|
|
}
|
2004-02-29 00:27:00 +00:00
|
|
|
|
2006-09-04 04:14:57 +00: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.
|
2011-11-16 08:38:26 +00:00
|
|
|
bool SparcTargetMachine::addPreEmitPass(PassManagerBase &PM){
|
2006-02-05 05:50:24 +00:00
|
|
|
PM.add(createSparcFPMoverPass(*this));
|
|
|
|
PM.add(createSparcDelaySlotFillerPass(*this));
|
2006-09-04 04:14:57 +00:00
|
|
|
return true;
|
|
|
|
}
|
2010-02-04 06:34:01 +00:00
|
|
|
|
|
|
|
SparcV8TargetMachine::SparcV8TargetMachine(const Target &T,
|
2011-07-20 07:51:56 +00:00
|
|
|
StringRef TT, StringRef CPU,
|
2011-12-02 22:16:29 +00:00
|
|
|
StringRef FS,
|
|
|
|
const TargetOptions &Options,
|
|
|
|
Reloc::Model RM,
|
2011-11-16 08:38:26 +00:00
|
|
|
CodeModel::Model CM,
|
|
|
|
CodeGenOpt::Level OL)
|
2011-12-02 22:16:29 +00:00
|
|
|
: SparcTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL, false) {
|
2010-02-04 06:34:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SparcV9TargetMachine::SparcV9TargetMachine(const Target &T,
|
2011-07-20 07:51:56 +00:00
|
|
|
StringRef TT, StringRef CPU,
|
2011-12-02 22:16:29 +00:00
|
|
|
StringRef FS,
|
|
|
|
const TargetOptions &Options,
|
|
|
|
Reloc::Model RM,
|
2011-11-16 08:38:26 +00:00
|
|
|
CodeModel::Model CM,
|
|
|
|
CodeGenOpt::Level OL)
|
2011-12-02 22:16:29 +00:00
|
|
|
: SparcTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL, true) {
|
2010-02-04 06:34:01 +00:00
|
|
|
}
|