ARMTargetMachine.cpp revision fde1b3bb2f15b74c713d98a79fcddaff1ac00dd1
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"
21using namespace llvm;
22
23namespace {
24  // Register the target.
25  RegisterTarget<ARMTargetMachine> X("arm", "  ARM");
26}
27
28
29const TargetAsmInfo *ARMTargetMachine::createTargetAsmInfo() const {
30  return new ARMTargetAsmInfo(*this);
31}
32
33
34/// TargetMachine ctor - Create an ILP32 architecture model
35///
36ARMTargetMachine::ARMTargetMachine(const Module &M, const std::string &FS)
37  : DataLayout("E-p:32:32") {
38}
39
40unsigned 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
53bool ARMTargetMachine::addInstSelector(FunctionPassManager &PM, bool Fast) {
54  PM.add(createARMISelDag(*this));
55  return false;
56}
57bool ARMTargetMachine::addAssemblyEmitter(FunctionPassManager &PM, bool Fast,
58                                          std::ostream &Out) {
59  // Output assembly language.
60  PM.add(createARMCodePrinterPass(Out, *this));
61  return false;
62}
63
64