blob: cf8f9aa3612f4876832208cbff52e4256ee9f6cd [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"
Tony Linthicumb4b54152011-12-12 21:14:40 +000024
25namespace llvm {
26
27class Module;
28
29class HexagonTargetMachine : public LLVMTargetMachine {
Micah Villmow3574eca2012-10-08 16:38:25 +000030 const DataLayout DL; // Calculates type size & alignment.
Tony Linthicumb4b54152011-12-12 21:14:40 +000031 HexagonSubtarget Subtarget;
Tony Linthicumb4b54152011-12-12 21:14:40 +000032 HexagonInstrInfo InstrInfo;
Benjamin Kramer90345622011-12-16 19:08:59 +000033 HexagonTargetLowering TLInfo;
Tony Linthicumb4b54152011-12-12 21:14:40 +000034 HexagonSelectionDAGInfo TSInfo;
35 HexagonFrameLowering FrameLowering;
36 const InstrItineraryData* InstrItins;
37
38public:
39 HexagonTargetMachine(const Target &T, StringRef TT,StringRef CPU,
Craig Topper1e0c9ab2012-03-17 09:24:09 +000040 StringRef FS, const TargetOptions &Options,
41 Reloc::Model RM, CodeModel::Model CM,
42 CodeGenOpt::Level OL);
Tony Linthicumb4b54152011-12-12 21:14:40 +000043
44 virtual const HexagonInstrInfo *getInstrInfo() const {
45 return &InstrInfo;
46 }
47 virtual const HexagonSubtarget *getSubtargetImpl() const {
48 return &Subtarget;
49 }
50 virtual const HexagonRegisterInfo *getRegisterInfo() const {
51 return &InstrInfo.getRegisterInfo();
52 }
53
54 virtual const InstrItineraryData* getInstrItineraryData() const {
55 return InstrItins;
56 }
57
58
59 virtual const HexagonTargetLowering* getTargetLowering() const {
60 return &TLInfo;
61 }
62
63 virtual const HexagonFrameLowering* getFrameLowering() const {
64 return &FrameLowering;
65 }
66
67 virtual const HexagonSelectionDAGInfo* getSelectionDAGInfo() const {
68 return &TSInfo;
69 }
70
Micah Villmow3574eca2012-10-08 16:38:25 +000071 virtual const DataLayout *getDataLayout() const { return &DL; }
Tony Linthicumb4b54152011-12-12 21:14:40 +000072 static unsigned getModuleMatchQuality(const Module &M);
73
74 // Pass Pipeline Configuration.
75 virtual bool addPassesForOptimizations(PassManagerBase &PM);
Andrew Trick061efcf2012-02-04 02:56:59 +000076 virtual TargetPassConfig *createPassConfig(PassManagerBase &PM);
Tony Linthicumb4b54152011-12-12 21:14:40 +000077};
78
79extern bool flag_aligned_memcpy;
80
81} // end namespace llvm
82
83#endif