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
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2006-09-07 23:39:26 +00:00
|
|
|
#include "SparcTargetAsmInfo.h"
|
2006-02-05 05:50:24 +00:00
|
|
|
#include "SparcTargetMachine.h"
|
|
|
|
#include "Sparc.h"
|
2004-02-25 19:28:19 +00:00
|
|
|
#include "llvm/Module.h"
|
|
|
|
#include "llvm/PassManager.h"
|
2009-07-25 06:49:55 +00:00
|
|
|
#include "llvm/Target/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.
|
|
|
|
RegisterTargetMachine<SparcTargetMachine> X(TheSparcTarget);
|
|
|
|
}
|
2009-06-16 20:12:29 +00:00
|
|
|
|
2006-09-07 23:39:26 +00:00
|
|
|
const TargetAsmInfo *SparcTargetMachine::createTargetAsmInfo() const {
|
2008-08-07 09:51:25 +00:00
|
|
|
// FIXME: Handle Solaris subtarget someday :)
|
|
|
|
return new SparcELFTargetAsmInfo(*this);
|
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
|
|
|
///
|
2009-07-15 20:24:03 +00: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-03 16:55:19 +00:00
|
|
|
Subtarget(M, FS), TLInfo(*this), InstrInfo(Subtarget),
|
2005-12-16 06:06:07 +00:00
|
|
|
FrameInfo(TargetFrameInfo::StackGrowsDown, 8, 0) {
|
2004-10-09 05:57:01 +00:00
|
|
|
}
|
|
|
|
|
2009-04-29 00:15:41 +00:00
|
|
|
bool SparcTargetMachine::addInstSelector(PassManagerBase &PM,
|
2009-04-29 23:29:43 +00:00
|
|
|
CodeGenOpt::Level OptLevel) {
|
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.
|
2009-04-29 23:29:43 +00:00
|
|
|
bool SparcTargetMachine::addPreEmitPass(PassManagerBase &PM,
|
|
|
|
CodeGenOpt::Level OptLevel){
|
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;
|
|
|
|
}
|