1 //===-- ZPUTargetMachine.cpp - Define TargetMachine for ZPU -------------===//
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 ZPU target spec.
12 //===----------------------------------------------------------------------===//
15 #include "ZPUMCAsmInfo.h"
16 #include "ZPUTargetMachine.h"
17 #include "llvm/PassManager.h"
18 #include "llvm/Target/TargetRegistry.h"
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));
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.
44 ZPUTargetMachine(const Target
&T
, const std::string
&TT
, const std::string
&FS
,
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")),
50 FrameInfo(TargetFrameInfo::StackGrowsUp
, 8, 0),
53 setRelocationModel(Reloc::Static
);