175335f5c1164845221d32802db7224ab40976d0
[oota-llvm.git] / lib / Target / ARM / ARMTargetMachine.cpp
1 //===-- ARMTargetMachine.cpp - Define TargetMachine for ARM ---------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file was developed by the "Instituto Nokia de Tecnologia" and
6 // is distributed under the University of Illinois Open Source
7 // License. See LICENSE.TXT for details.
8 //
9 //===----------------------------------------------------------------------===//
10 //
11 //
12 //===----------------------------------------------------------------------===//
13
14 #include "ARMTargetMachine.h"
15 #include "ARMFrameInfo.h"
16 #include "ARM.h"
17 #include "llvm/Module.h"
18 #include "llvm/PassManager.h"
19 #include "llvm/Target/TargetMachineRegistry.h"
20 using namespace llvm;
21
22 namespace {
23   // Register the target.
24   RegisterTarget<ARMTargetMachine> X("arm", "  ARM");
25 }
26
27 /// TargetMachine ctor - Create an ILP32 architecture model
28 ///
29 ARMTargetMachine::ARMTargetMachine(const Module &M, const std::string &FS)
30   : DataLayout("E-p:32:32") {
31 }
32
33 unsigned ARMTargetMachine::getModuleMatchQuality(const Module &M) {
34   std::string TT = M.getTargetTriple();
35   if (TT.size() >= 4 && std::string(TT.begin(), TT.begin()+4) == "arm-")
36     return 20;
37
38   if (M.getPointerSize() == Module::Pointer32)
39     return 1;
40   else
41     return 0;
42 }
43
44
45 // Pass Pipeline Configuration
46 bool ARMTargetMachine::addInstSelector(FunctionPassManager &PM, bool Fast) {
47   PM.add(createARMISelDag(*this));
48   return false;
49 }
50 bool ARMTargetMachine::addAssemblyEmitter(FunctionPassManager &PM, bool Fast, 
51                                           std::ostream &Out) {
52   // Output assembly language.
53   PM.add(createARMCodePrinterPass(Out, *this));
54   return false;
55 }
56