blob: 79aa45d8def7900df8d76143673340ee2f798fa9 [file] [log] [blame]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001//===-- ARMTargetMachine.h - Define TargetMachine for ARM -------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
Chris Lattner081ce942007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file declares the ARM specific subclass of TargetMachine.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef ARMTARGETMACHINE_H
15#define ARMTARGETMACHINE_H
16
17#include "llvm/Target/TargetMachine.h"
18#include "llvm/Target/TargetData.h"
19#include "llvm/Target/TargetFrameInfo.h"
20#include "ARMInstrInfo.h"
21#include "ARMFrameInfo.h"
22#include "ARMJITInfo.h"
23#include "ARMSubtarget.h"
24#include "ARMISelLowering.h"
25
26namespace llvm {
27
28class Module;
29
30class ARMTargetMachine : public LLVMTargetMachine {
31 ARMSubtarget Subtarget;
32 const TargetData DataLayout; // Calculates type size & alignment
33 ARMInstrInfo InstrInfo;
34 ARMFrameInfo FrameInfo;
35 ARMJITInfo JITInfo;
36 ARMTargetLowering TLInfo;
37
38public:
39 ARMTargetMachine(const Module &M, const std::string &FS, bool isThumb = false);
40
Dan Gohmanb41dfba2008-05-14 01:58:56 +000041 virtual const ARMInstrInfo *getInstrInfo() const { return &InstrInfo; }
42 virtual const ARMFrameInfo *getFrameInfo() const { return &FrameInfo; }
43 virtual ARMJITInfo *getJITInfo() { return &JITInfo; }
44 virtual const ARMRegisterInfo *getRegisterInfo() const {
Dan Gohmanf17a25c2007-07-18 16:29:46 +000045 return &InstrInfo.getRegisterInfo();
46 }
47 virtual const TargetData *getTargetData() const { return &DataLayout; }
48 virtual const ARMSubtarget *getSubtargetImpl() const { return &Subtarget; }
49 virtual ARMTargetLowering *getTargetLowering() const {
50 return const_cast<ARMTargetLowering*>(&TLInfo);
51 }
52 static unsigned getModuleMatchQuality(const Module &M);
53 static unsigned getJITMatchQuality();
54
55 virtual const TargetAsmInfo *createTargetAsmInfo() const;
56
57 // Pass Pipeline Configuration
Dan Gohmane34aa772008-03-11 22:29:46 +000058 virtual bool addInstSelector(PassManagerBase &PM, bool Fast);
59 virtual bool addPreEmitPass(PassManagerBase &PM, bool Fast);
60 virtual bool addAssemblyEmitter(PassManagerBase &PM, bool Fast,
Dan Gohmanf17a25c2007-07-18 16:29:46 +000061 std::ostream &Out);
Dan Gohmane34aa772008-03-11 22:29:46 +000062 virtual bool addCodeEmitter(PassManagerBase &PM, bool Fast,
Evan Cheng77547212007-07-20 21:56:13 +000063 bool DumpAsm, MachineCodeEmitter &MCE);
Dan Gohmane34aa772008-03-11 22:29:46 +000064 virtual bool addSimpleCodeEmitter(PassManagerBase &PM, bool Fast,
Evan Cheng77547212007-07-20 21:56:13 +000065 bool DumpAsm, MachineCodeEmitter &MCE);
Dan Gohmanf17a25c2007-07-18 16:29:46 +000066};
67
68/// ThumbTargetMachine - Thumb target machine.
69///
70class ThumbTargetMachine : public ARMTargetMachine {
71public:
72 ThumbTargetMachine(const Module &M, const std::string &FS);
73
74 static unsigned getJITMatchQuality();
75 static unsigned getModuleMatchQuality(const Module &M);
76};
77
78} // end namespace llvm
79
80#endif