blob: 175335f5c1164845221d32802db7224ab40976d0 [file] [log] [blame]
Rafael Espindola7bc59bc2006-05-14 22:18:28 +00001//===-- 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"
Rafael Espindolaec46ea32006-08-16 14:43:33 +000015#include "ARMFrameInfo.h"
Rafael Espindola7bc59bc2006-05-14 22:18:28 +000016#include "ARM.h"
Rafael Espindola7bc59bc2006-05-14 22:18:28 +000017#include "llvm/Module.h"
18#include "llvm/PassManager.h"
Rafael Espindola7bc59bc2006-05-14 22:18:28 +000019#include "llvm/Target/TargetMachineRegistry.h"
Rafael Espindola7bc59bc2006-05-14 22:18:28 +000020using namespace llvm;
21
22namespace {
23 // Register the target.
24 RegisterTarget<ARMTargetMachine> X("arm", " ARM");
25}
26
27/// TargetMachine ctor - Create an ILP32 architecture model
28///
29ARMTargetMachine::ARMTargetMachine(const Module &M, const std::string &FS)
Chris Lattnerc4fa3862006-09-03 18:44:02 +000030 : DataLayout("E-p:32:32") {
Rafael Espindola7bc59bc2006-05-14 22:18:28 +000031}
32
33unsigned 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
Rafael Espindola7bc59bc2006-05-14 22:18:28 +000044
Chris Lattner1911fd42006-09-04 04:14:57 +000045// Pass Pipeline Configuration
46bool ARMTargetMachine::addInstSelector(FunctionPassManager &PM, bool Fast) {
Rafael Espindola7bc59bc2006-05-14 22:18:28 +000047 PM.add(createARMISelDag(*this));
Chris Lattner1911fd42006-09-04 04:14:57 +000048 return false;
49}
50bool ARMTargetMachine::addAssemblyEmitter(FunctionPassManager &PM, bool Fast,
51 std::ostream &Out) {
Rafael Espindola7bc59bc2006-05-14 22:18:28 +000052 // Output assembly language.
53 PM.add(createARMCodePrinterPass(Out, *this));
Rafael Espindola7bc59bc2006-05-14 22:18:28 +000054 return false;
55}
56