blob: a99396d5146d15916471297d66681106e9ada238 [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
Tony Linthicumb4b54152011-12-12 21:14:40 +000017#include "HexagonFrameLowering.h"
Chandler Carrutha1514e22012-12-04 07:12:27 +000018#include "HexagonISelLowering.h"
19#include "HexagonInstrInfo.h"
20#include "HexagonSelectionDAGInfo.h"
21#include "HexagonSubtarget.h"
Chandler Carruth0b8c9a82013-01-02 11:36:10 +000022#include "llvm/IR/DataLayout.h"
Chandler Carrutha1514e22012-12-04 07:12:27 +000023#include "llvm/Target/TargetMachine.h"
Nadav Rotemcbd9a192012-10-18 23:22:48 +000024#include "llvm/Target/TargetTransformImpl.h"
Tony Linthicumb4b54152011-12-12 21:14:40 +000025
26namespace llvm {
27
28class Module;
29
30class HexagonTargetMachine : public LLVMTargetMachine {
Micah Villmow3574eca2012-10-08 16:38:25 +000031 const DataLayout DL; // Calculates type size & alignment.
Tony Linthicumb4b54152011-12-12 21:14:40 +000032 HexagonSubtarget Subtarget;
Tony Linthicumb4b54152011-12-12 21:14:40 +000033 HexagonInstrInfo InstrInfo;
Benjamin Kramer90345622011-12-16 19:08:59 +000034 HexagonTargetLowering TLInfo;
Tony Linthicumb4b54152011-12-12 21:14:40 +000035 HexagonSelectionDAGInfo TSInfo;
36 HexagonFrameLowering FrameLowering;
37 const InstrItineraryData* InstrItins;
Nadav Rotemcbd9a192012-10-18 23:22:48 +000038 ScalarTargetTransformImpl STTI;
39 VectorTargetTransformImpl VTTI;
Tony Linthicumb4b54152011-12-12 21:14:40 +000040
41public:
42 HexagonTargetMachine(const Target &T, StringRef TT,StringRef CPU,
Craig Topper1e0c9ab2012-03-17 09:24:09 +000043 StringRef FS, const TargetOptions &Options,
44 Reloc::Model RM, CodeModel::Model CM,
45 CodeGenOpt::Level OL);
Tony Linthicumb4b54152011-12-12 21:14:40 +000046
47 virtual const HexagonInstrInfo *getInstrInfo() const {
48 return &InstrInfo;
49 }
50 virtual const HexagonSubtarget *getSubtargetImpl() const {
51 return &Subtarget;
52 }
53 virtual const HexagonRegisterInfo *getRegisterInfo() const {
54 return &InstrInfo.getRegisterInfo();
55 }
56
57 virtual const InstrItineraryData* getInstrItineraryData() const {
58 return InstrItins;
59 }
60
61
62 virtual const HexagonTargetLowering* getTargetLowering() const {
63 return &TLInfo;
64 }
65
66 virtual const HexagonFrameLowering* getFrameLowering() const {
67 return &FrameLowering;
68 }
69
70 virtual const HexagonSelectionDAGInfo* getSelectionDAGInfo() const {
71 return &TSInfo;
72 }
73
Nadav Rotemcbd9a192012-10-18 23:22:48 +000074 virtual const ScalarTargetTransformInfo *getScalarTargetTransformInfo()const {
75 return &STTI;
76 }
77
78 virtual const VectorTargetTransformInfo *getVectorTargetTransformInfo()const {
79 return &VTTI;
80 }
81
Micah Villmow3574eca2012-10-08 16:38:25 +000082 virtual const DataLayout *getDataLayout() const { return &DL; }
Tony Linthicumb4b54152011-12-12 21:14:40 +000083 static unsigned getModuleMatchQuality(const Module &M);
84
85 // Pass Pipeline Configuration.
86 virtual bool addPassesForOptimizations(PassManagerBase &PM);
Andrew Trick061efcf2012-02-04 02:56:59 +000087 virtual TargetPassConfig *createPassConfig(PassManagerBase &PM);
Tony Linthicumb4b54152011-12-12 21:14:40 +000088};
89
90extern bool flag_aligned_memcpy;
91
92} // end namespace llvm
93
94#endif