1 //===-- MBlazeTargetMachine.cpp - Define TargetMachine for MBlaze ---------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // Implements the info about MBlaze target spec.
12 //===----------------------------------------------------------------------===//
15 #include "MBlazeMCAsmInfo.h"
16 #include "MBlazeTargetMachine.h"
17 #include "llvm/PassManager.h"
18 #include "llvm/Target/TargetRegistry.h"
21 extern "C" void LLVMInitializeMBlazeTarget() {
22 // Register the target.
23 RegisterTargetMachine<MBlazeTargetMachine> X(TheMBlazeTarget);
24 RegisterAsmInfo<MBlazeMCAsmInfo> A(TheMBlazeTarget);
27 // DataLayout --> Big-endian, 32-bit pointer/ABI/alignment
28 // The stack is always 8 byte aligned
29 // On function prologue, the stack is created by decrementing
30 // its pointer. Once decremented, all references are done with positive
31 // offset from the stack/frame pointer, using StackGrowsUp enables
32 // an easier handling.
34 MBlazeTargetMachine(const Target &T, const std::string &TT,
35 const std::string &FS):
36 LLVMTargetMachine(T, TT),
38 DataLayout("E-p:32:32-i8:8:8-i16:16:16-i64:32:32-"
39 "f64:32:32-v64:32:32-v128:32:32-n32"),
41 FrameInfo(TargetFrameInfo::StackGrowsUp, 8, 0),
43 if (getRelocationModel() == Reloc::Default) {
44 setRelocationModel(Reloc::Static);
47 if (getCodeModel() == CodeModel::Default)
48 setCodeModel(CodeModel::Small);
51 // Install an instruction selector pass using
52 // the ISelDag to gen MBlaze code.
53 bool MBlazeTargetMachine::
54 addInstSelector(PassManagerBase &PM, CodeGenOpt::Level OptLevel) {
55 PM.add(createMBlazeISelDag(*this));
59 // Implemented by targets that want to run passes immediately before
60 // machine code is emitted. return true if -print-machineinstrs should
61 // print out the code after the passes.
62 bool MBlazeTargetMachine::
63 addPreEmitPass(PassManagerBase &PM, CodeGenOpt::Level OptLevel) {
64 PM.add(createMBlazeDelaySlotFillerPass(*this));