blob: e27d3ae94334a988ffcd13430e7eaeb0fab2b60b [file] [log] [blame]
Tony Linthicumb4b54152011-12-12 21:14:40 +00001//=-- HexagonTargetMachine.h - Define TargetMachine for Hexagon ---*- C++ -*-=//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file declares the Hexagon specific subclass of TargetMachine.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef HexagonTARGETMACHINE_H
15#define HexagonTARGETMACHINE_H
16
17#include "llvm/Target/TargetMachine.h"
18#include "llvm/Target/TargetData.h"
19#include "HexagonInstrInfo.h"
20#include "HexagonSubtarget.h"
21#include "HexagonISelLowering.h"
22#include "HexagonSelectionDAGInfo.h"
23#include "HexagonFrameLowering.h"
24
25namespace llvm {
26
27class Module;
28
29class HexagonTargetMachine : public LLVMTargetMachine {
30 const TargetData DataLayout; // Calculates type size & alignment.
31 HexagonSubtarget Subtarget;
32 HexagonTargetLowering TLInfo;
33 HexagonInstrInfo InstrInfo;
34 HexagonSelectionDAGInfo TSInfo;
35 HexagonFrameLowering FrameLowering;
36 const InstrItineraryData* InstrItins;
37
38public:
39 HexagonTargetMachine(const Target &T, StringRef TT,StringRef CPU,
40 StringRef FS, TargetOptions Options, Reloc::Model RM,
41 CodeModel::Model CM, CodeGenOpt::Level OL);
42
43 virtual const HexagonInstrInfo *getInstrInfo() const {
44 return &InstrInfo;
45 }
46 virtual const HexagonSubtarget *getSubtargetImpl() const {
47 return &Subtarget;
48 }
49 virtual const HexagonRegisterInfo *getRegisterInfo() const {
50 return &InstrInfo.getRegisterInfo();
51 }
52
53 virtual const InstrItineraryData* getInstrItineraryData() const {
54 return InstrItins;
55 }
56
57
58 virtual const HexagonTargetLowering* getTargetLowering() const {
59 return &TLInfo;
60 }
61
62 virtual const HexagonFrameLowering* getFrameLowering() const {
63 return &FrameLowering;
64 }
65
66 virtual const HexagonSelectionDAGInfo* getSelectionDAGInfo() const {
67 return &TSInfo;
68 }
69
70 virtual const TargetData *getTargetData() const { return &DataLayout; }
71 static unsigned getModuleMatchQuality(const Module &M);
72
73 // Pass Pipeline Configuration.
74 virtual bool addPassesForOptimizations(PassManagerBase &PM);
75 virtual bool addInstSelector(PassManagerBase &PM);
76 virtual bool addPreEmitPass(PassManagerBase &PM);
77 virtual bool addPreRegAlloc(llvm::PassManagerBase &PM);
78 virtual bool addPostRegAlloc(PassManagerBase &PM);
79 virtual bool addPreSched2(PassManagerBase &PM);
80};
81
82extern bool flag_aligned_memcpy;
83
84} // end namespace llvm
85
86#endif