b1afc7e61aee4e5a64bfca1450c330916baf4e65
[oota-llvm.git] / lib / Target / XCore / XCoreTargetMachine.cpp
1 //===-- XCoreTargetMachine.cpp - Define TargetMachine for XCore -----------===//
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 //
11 //===----------------------------------------------------------------------===//
12
13 #include "XCoreTargetAsmInfo.h"
14 #include "XCoreTargetMachine.h"
15 #include "XCore.h"
16 #include "llvm/Module.h"
17 #include "llvm/PassManager.h"
18 #include "llvm/Target/TargetRegistry.h"
19 using namespace llvm;
20
21 /// XCoreTargetMachine ctor - Create an ILP32 architecture model
22 ///
23 XCoreTargetMachine::XCoreTargetMachine(const Target &T, const std::string &TT,
24                                        const std::string &FS)
25   : LLVMTargetMachine(T, TT),
26     Subtarget(TT, FS),
27     DataLayout("e-p:32:32:32-a0:0:32-f32:32:32-f64:32:32-i1:8:32-i8:8:32-"
28                "i16:16:32-i32:32:32-i64:32:32"),
29     InstrInfo(),
30     FrameInfo(*this),
31     TLInfo(*this) {
32 }
33
34 bool XCoreTargetMachine::addInstSelector(PassManagerBase &PM,
35                                          CodeGenOpt::Level OptLevel) {
36   PM.add(createXCoreISelDag(*this));
37   return false;
38 }
39
40 // Force static initialization.
41 extern "C" void LLVMInitializeXCoreTarget() {
42   RegisterTargetMachine<XCoreTargetMachine> X(TheXCoreTarget);
43   RegisterAsmInfo<XCoreTargetAsmInfo> Y(TheXCoreTarget);
44 }