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
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2006-09-08 07:39:26 +08:00
|
|
|
#include "SparcTargetAsmInfo.h"
|
2006-02-05 13:50:24 +08:00
|
|
|
#include "SparcTargetMachine.h"
|
|
|
|
#include "Sparc.h"
|
|
|
|
#include "llvm/Module.h"
|
|
|
|
#include "llvm/PassManager.h"
|
|
|
|
#include "llvm/Target/TargetMachineRegistry.h"
|
|
|
|
using namespace llvm;
|
|
|
|
|
2008-05-13 08:00:25 +08:00
|
|
|
// Register the target.
|
2009-07-16 04:24:03 +08:00
|
|
|
static RegisterTarget<SparcTargetMachine> X(TheSparcTarget, "sparc", "SPARC");
|
2006-02-05 13:50:24 +08:00
|
|
|
|
2009-06-24 07:59:40 +08:00
|
|
|
// Force static initialization.
|
|
|
|
extern "C" void LLVMInitializeSparcTarget() { }
|
2009-06-17 04:12:29 +08:00
|
|
|
|
2006-09-08 07:39:26 +08:00
|
|
|
const TargetAsmInfo *SparcTargetMachine::createTargetAsmInfo() const {
|
2008-08-07 17:51:25 +08:00
|
|
|
// FIXME: Handle Solaris subtarget someday :)
|
|
|
|
return new SparcELFTargetAsmInfo(*this);
|
2006-09-08 07:39:26 +08:00
|
|
|
}
|
|
|
|
|
2006-02-05 13:50:24 +08:00
|
|
|
/// SparcTargetMachine ctor - Create an ILP32 architecture model
|
|
|
|
///
|
2009-07-16 04:24:03 +08:00
|
|
|
SparcTargetMachine::SparcTargetMachine(const Target &T, const Module &M,
|
|
|
|
const std::string &FS)
|
|
|
|
: LLVMTargetMachine(T),
|
|
|
|
DataLayout("E-p:32:32-f128:128:128"),
|
2008-10-04 00:55:19 +08:00
|
|
|
Subtarget(M, FS), TLInfo(*this), InstrInfo(Subtarget),
|
2006-02-05 13:50:24 +08:00
|
|
|
FrameInfo(TargetFrameInfo::StackGrowsDown, 8, 0) {
|
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
}
|