Use %ull here.
[llvm/stm8.git] / lib / Target / MBlaze / MBlazeTargetMachine.cpp
blobf48189dc26786e985b3bf0026569b518963deeae
1 //===-- MBlazeTargetMachine.cpp - Define TargetMachine for MBlaze ---------===//
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 //
10 // Implements the info about MBlaze target spec.
12 //===----------------------------------------------------------------------===//
14 #include "MBlaze.h"
15 #include "MBlazeMCAsmInfo.h"
16 #include "MBlazeTargetMachine.h"
17 #include "llvm/PassManager.h"
18 #include "llvm/CodeGen/Passes.h"
19 #include "llvm/Support/FormattedStream.h"
20 #include "llvm/Target/TargetOptions.h"
21 #include "llvm/Target/TargetRegistry.h"
22 using namespace llvm;
24 static MCAsmInfo *createMCAsmInfo(const Target &T, StringRef TT) {
25 Triple TheTriple(TT);
26 switch (TheTriple.getOS()) {
27 default:
28 return new MBlazeMCAsmInfo();
32 static MCStreamer *createMCStreamer(const Target &T, const std::string &TT,
33 MCContext &Ctx, TargetAsmBackend &TAB,
34 raw_ostream &_OS,
35 MCCodeEmitter *_Emitter,
36 bool RelaxAll,
37 bool NoExecStack) {
38 Triple TheTriple(TT);
39 switch (TheTriple.getOS()) {
40 case Triple::Darwin:
41 llvm_unreachable("MBlaze does not support Darwin MACH-O format");
42 return NULL;
43 case Triple::MinGW32:
44 case Triple::Cygwin:
45 case Triple::Win32:
46 llvm_unreachable("MBlaze does not support Windows COFF format");
47 return NULL;
48 default:
49 return createELFStreamer(Ctx, TAB, _OS, _Emitter, RelaxAll,
50 NoExecStack);
55 extern "C" void LLVMInitializeMBlazeTarget() {
56 // Register the target.
57 RegisterTargetMachine<MBlazeTargetMachine> X(TheMBlazeTarget);
59 // Register the target asm info.
60 RegisterAsmInfoFn A(TheMBlazeTarget, createMCAsmInfo);
62 // Register the MC code emitter
63 TargetRegistry::RegisterCodeEmitter(TheMBlazeTarget,
64 llvm::createMBlazeMCCodeEmitter);
66 // Register the asm backend
67 TargetRegistry::RegisterAsmBackend(TheMBlazeTarget,
68 createMBlazeAsmBackend);
70 // Register the object streamer
71 TargetRegistry::RegisterObjectStreamer(TheMBlazeTarget,
72 createMCStreamer);
76 // DataLayout --> Big-endian, 32-bit pointer/ABI/alignment
77 // The stack is always 8 byte aligned
78 // On function prologue, the stack is created by decrementing
79 // its pointer. Once decremented, all references are done with positive
80 // offset from the stack/frame pointer, using StackGrowsUp enables
81 // an easier handling.
82 MBlazeTargetMachine::
83 MBlazeTargetMachine(const Target &T, const std::string &TT,
84 const std::string &FS):
85 LLVMTargetMachine(T, TT),
86 Subtarget(TT, FS),
87 DataLayout("E-p:32:32:32-i8:8:8-i16:16:16"),
88 InstrInfo(*this),
89 FrameLowering(Subtarget),
90 TLInfo(*this), TSInfo(*this), ELFWriterInfo(*this),
91 InstrItins(Subtarget.getInstrItineraryData()) {
92 if (getRelocationModel() == Reloc::Default) {
93 setRelocationModel(Reloc::Static);
96 if (getCodeModel() == CodeModel::Default)
97 setCodeModel(CodeModel::Small);
100 // Install an instruction selector pass using
101 // the ISelDag to gen MBlaze code.
102 bool MBlazeTargetMachine::addInstSelector(PassManagerBase &PM,
103 CodeGenOpt::Level OptLevel) {
104 PM.add(createMBlazeISelDag(*this));
105 return false;
108 // Implemented by targets that want to run passes immediately before
109 // machine code is emitted. return true if -print-machineinstrs should
110 // print out the code after the passes.
111 bool MBlazeTargetMachine::addPreEmitPass(PassManagerBase &PM,
112 CodeGenOpt::Level OptLevel) {
113 PM.add(createMBlazeDelaySlotFillerPass(*this));
114 return true;