blob: 505e2b11d59f73bfb5aa186dedd64e42c6ca64a6 [file] [log] [blame]
Chris Lattner158e1f52006-02-05 05:50:24 +00001//===-- SparcTargetMachine.cpp - Define TargetMachine for Sparc -----------===//
2//
3// The LLVM Compiler Infrastructure
4//
Chris Lattnerf3ebc3f2007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Chris Lattner158e1f52006-02-05 05:50:24 +00007//
8//===----------------------------------------------------------------------===//
9//
10//
11//===----------------------------------------------------------------------===//
12
Jim Laskeyae92ce82006-09-07 23:39:26 +000013#include "SparcTargetAsmInfo.h"
Chris Lattner158e1f52006-02-05 05:50:24 +000014#include "SparcTargetMachine.h"
15#include "Sparc.h"
Chris Lattner158e1f52006-02-05 05:50:24 +000016#include "llvm/PassManager.h"
Daniel Dunbar5680b4f2009-07-25 06:49:55 +000017#include "llvm/Target/TargetRegistry.h"
Chris Lattner158e1f52006-02-05 05:50:24 +000018using namespace llvm;
19
Daniel Dunbar5680b4f2009-07-25 06:49:55 +000020extern "C" void LLVMInitializeSparcTarget() {
21 // Register the target.
22 RegisterTargetMachine<SparcTargetMachine> X(TheSparcTarget);
Chris Lattner9a6cf912009-08-12 07:22:17 +000023 RegisterAsmInfo<SparcELFTargetAsmInfo> Y(TheSparcTarget);
Douglas Gregor1b731d52009-06-16 20:12:29 +000024
Jim Laskeyae92ce82006-09-07 23:39:26 +000025}
26
Chris Lattner158e1f52006-02-05 05:50:24 +000027/// SparcTargetMachine ctor - Create an ILP32 architecture model
28///
Daniel Dunbarc3719c32009-08-02 23:37:13 +000029SparcTargetMachine::SparcTargetMachine(const Target &T, const std::string &TT,
Daniel Dunbare8338102009-07-15 20:24:03 +000030 const std::string &FS)
Chris Lattner2c309702009-08-11 20:42:37 +000031 : LLVMTargetMachine(T, TT),
Daniel Dunbare8338102009-07-15 20:24:03 +000032 DataLayout("E-p:32:32-f128:128:128"),
Daniel Dunbarc3719c32009-08-02 23:37:13 +000033 Subtarget(TT, FS), TLInfo(*this), InstrInfo(Subtarget),
Chris Lattner158e1f52006-02-05 05:50:24 +000034 FrameInfo(TargetFrameInfo::StackGrowsDown, 8, 0) {
35}
36
Bill Wendling084669a2009-04-29 00:15:41 +000037bool SparcTargetMachine::addInstSelector(PassManagerBase &PM,
Bill Wendling026e5d72009-04-29 23:29:43 +000038 CodeGenOpt::Level OptLevel) {
Chris Lattner158e1f52006-02-05 05:50:24 +000039 PM.add(createSparcISelDag(*this));
Chris Lattner158e1f52006-02-05 05:50:24 +000040 return false;
41}
42
Chris Lattner12e97302006-09-04 04:14:57 +000043/// addPreEmitPass - This pass may be implemented by targets that want to run
44/// passes immediately before machine code is emitted. This should return
45/// true if -print-machineinstrs should print out the code after the passes.
Bill Wendling026e5d72009-04-29 23:29:43 +000046bool SparcTargetMachine::addPreEmitPass(PassManagerBase &PM,
47 CodeGenOpt::Level OptLevel){
Chris Lattner12e97302006-09-04 04:14:57 +000048 PM.add(createSparcFPMoverPass(*this));
49 PM.add(createSparcDelaySlotFillerPass(*this));
50 return true;
51}