implement smull and umull
[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 "ARMTargetAsmInfo.h"
15 #include "ARMTargetMachine.h"
16 #include "ARMFrameInfo.h"
17 #include "ARM.h"
18 #include "llvm/Module.h"
19 #include "llvm/PassManager.h"
20 #include "llvm/Target/TargetMachineRegistry.h"
21 using namespace llvm;
22
23 namespace {
24   // Register the target.
25   RegisterTarget<ARMTargetMachine> X("arm", "  ARM");
26 }
27
28
29 const TargetAsmInfo *ARMTargetMachine::createTargetAsmInfo() const {
30   return new ARMTargetAsmInfo(*this);
31 }
32
33
34 /// TargetMachine ctor - Create an ILP32 architecture model
35 ///
36 ARMTargetMachine::ARMTargetMachine(const Module &M, const std::string &FS)
37   : DataLayout("e-p:32:32") {
38 }
39
40 unsigned ARMTargetMachine::getModuleMatchQuality(const Module &M) {
41   std::string TT = M.getTargetTriple();
42   if (TT.size() >= 4 && std::string(TT.begin(), TT.begin()+4) == "arm-")
43     return 20;
44
45   if (M.getPointerSize() == Module::Pointer32)
46     return 1;
47   else
48     return 0;
49 }
50
51
52 // Pass Pipeline Configuration
53 bool ARMTargetMachine::addInstSelector(FunctionPassManager &PM, bool Fast) {
54   PM.add(createARMISelDag(*this));
55   return false;
56 }
57
58 bool ARMTargetMachine::addPostRegAlloc(FunctionPassManager &PM, bool Fast) {
59   PM.add(createARMFixMulPass());
60   return true;
61 }
62
63 bool ARMTargetMachine::addAssemblyEmitter(FunctionPassManager &PM, bool Fast, 
64                                           std::ostream &Out) {
65   // Output assembly language.
66   PM.add(createARMCodePrinterPass(Out, *this));
67   return false;
68 }