zpu: wip eke out some simple instructions for load/store/add
[llvm/zpu.git] / lib / Target / ZPU / ZPUTargetMachine.cpp
blob5e15850bbeb07e9b8e48f4cdd22d22756ee6291e
1 //===-- ZPUTargetMachine.cpp - Define TargetMachine for ZPU -------------===//
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 ZPU target spec.
12 //===----------------------------------------------------------------------===//
14 #include "ZPU.h"
15 #include "ZPUMCAsmInfo.h"
16 #include "ZPUTargetMachine.h"
17 #include "llvm/PassManager.h"
18 #include "llvm/Target/TargetRegistry.h"
19 using namespace llvm;
21 extern "C" void LLVMInitializeZPUTarget() {
22 // Register the target.
23 RegisterTargetMachine<ZPUTargetMachine> X(TheZPUTarget);
24 RegisterAsmInfo<ZPUMCAsmInfo> Y(TheZPUTarget);
28 bool ZPUTargetMachine::
29 addInstSelector(PassManagerBase &PM, CodeGenOpt::Level OptLevel)
31 PM.add(createZPUISelDag(*this));
32 return false;
36 // DataLayout --> Big-endian, 32-bit pointer/ABI/alignment
37 // The stack is always 8 byte aligned
38 // On function prologue, the stack is created by decrementing
39 // its pointer. Once decremented, all references are done with positive
40 // offset from the stack/frame pointer, using StackGrowsUp enables
41 // an easier handling.
42 // Using CodeModel::Large enables different CALL behavior.
43 ZPUTargetMachine::
44 ZPUTargetMachine(const Target &T, const std::string &TT, const std::string &FS,
45 bool isLittle):
46 LLVMTargetMachine(T, TT),
47 Subtarget(TT, FS, isLittle),
48 DataLayout(std::string("e-p:32:32:32-i8:8:32-i16:16:32-n32")),
49 InstrInfo(*this),
50 FrameInfo(TargetFrameInfo::StackGrowsUp, 8, 0),
51 TLInfo(*this)
53 setRelocationModel(Reloc::Static);