Fix part 1 of pr4682. PICADD is a 16-bit instruction even in thumb2 mode.
[llvm/avr.git] / lib / Target / Sparc / SparcTargetMachine.cpp
blobf7c172216afca8253e11f92df1f6a990feddc149
1 //===-- SparcTargetMachine.cpp - Define TargetMachine for Sparc -----------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
11 //===----------------------------------------------------------------------===//
13 #include "SparcTargetAsmInfo.h"
14 #include "SparcTargetMachine.h"
15 #include "Sparc.h"
16 #include "llvm/PassManager.h"
17 #include "llvm/Target/TargetRegistry.h"
18 using namespace llvm;
20 extern "C" void LLVMInitializeSparcTarget() {
21 // Register the target.
22 RegisterTargetMachine<SparcTargetMachine> X(TheSparcTarget);
25 const TargetAsmInfo *SparcTargetMachine::createTargetAsmInfo() const {
26 // FIXME: Handle Solaris subtarget someday :)
27 return new SparcELFTargetAsmInfo();
30 /// SparcTargetMachine ctor - Create an ILP32 architecture model
31 ///
32 SparcTargetMachine::SparcTargetMachine(const Target &T, const std::string &TT,
33 const std::string &FS)
34 : LLVMTargetMachine(T),
35 DataLayout("E-p:32:32-f128:128:128"),
36 Subtarget(TT, FS), TLInfo(*this), InstrInfo(Subtarget),
37 FrameInfo(TargetFrameInfo::StackGrowsDown, 8, 0) {
40 bool SparcTargetMachine::addInstSelector(PassManagerBase &PM,
41 CodeGenOpt::Level OptLevel) {
42 PM.add(createSparcISelDag(*this));
43 return false;
46 /// addPreEmitPass - This pass may be implemented by targets that want to run
47 /// passes immediately before machine code is emitted. This should return
48 /// true if -print-machineinstrs should print out the code after the passes.
49 bool SparcTargetMachine::addPreEmitPass(PassManagerBase &PM,
50 CodeGenOpt::Level OptLevel){
51 PM.add(createSparcFPMoverPass(*this));
52 PM.add(createSparcDelaySlotFillerPass(*this));
53 return true;