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
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2006-09-08 01:39:26 +02:00
|
|
|
#include "SparcTargetAsmInfo.h"
|
2006-02-05 06:50:24 +01:00
|
|
|
#include "SparcTargetMachine.h"
|
|
|
|
#include "Sparc.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.
|
|
|
|
RegisterTargetMachine<SparcTargetMachine> X(TheSparcTarget);
|
|
|
|
}
|
2009-06-16 22:12:29 +02:00
|
|
|
|
2006-09-08 01:39:26 +02:00
|
|
|
const TargetAsmInfo *SparcTargetMachine::createTargetAsmInfo() const {
|
2008-08-07 11:51:25 +02:00
|
|
|
// FIXME: Handle Solaris subtarget someday :)
|
2009-08-02 06:30:59 +02:00
|
|
|
return new SparcELFTargetAsmInfo();
|
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,
|
2009-07-15 22:24:03 +02:00
|
|
|
const std::string &FS)
|
|
|
|
: LLVMTargetMachine(T),
|
|
|
|
DataLayout("E-p:32:32-f128:128:128"),
|
2009-08-03 01:37:13 +02:00
|
|
|
Subtarget(TT, FS), TLInfo(*this), InstrInfo(Subtarget),
|
2006-02-05 06:50:24 +01:00
|
|
|
FrameInfo(TargetFrameInfo::StackGrowsDown, 8, 0) {
|
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
}
|