blob: fcf5f7f15ca40235f3febbf01d2fb2f41aae0da3 [file] [log] [blame]
Tony Linthicum1213a7a2011-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 Linthicum1213a7a2011-12-12 21:14:40 +000017#include "HexagonFrameLowering.h"
Chandler Carruth802d7552012-12-04 07:12:27 +000018#include "HexagonISelLowering.h"
19#include "HexagonInstrInfo.h"
20#include "HexagonSelectionDAGInfo.h"
21#include "HexagonSubtarget.h"
Chandler Carruth9fb823b2013-01-02 11:36:10 +000022#include "llvm/IR/DataLayout.h"
Chandler Carruth802d7552012-12-04 07:12:27 +000023#include "llvm/Target/TargetMachine.h"
Tony Linthicum1213a7a2011-12-12 21:14:40 +000024
25namespace llvm {
26
27class Module;
28
29class HexagonTargetMachine : public LLVMTargetMachine {
Micah Villmowcdfe20b2012-10-08 16:38:25 +000030 const DataLayout DL; // Calculates type size & alignment.
Tony Linthicum1213a7a2011-12-12 21:14:40 +000031 HexagonSubtarget Subtarget;
Tony Linthicum1213a7a2011-12-12 21:14:40 +000032 HexagonInstrInfo InstrInfo;
Benjamin Kramer9ca2e722011-12-16 19:08:59 +000033 HexagonTargetLowering TLInfo;
Tony Linthicum1213a7a2011-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 Topperb5454082012-03-17 09:24:09 +000040 StringRef FS, const TargetOptions &Options,
41 Reloc::Model RM, CodeModel::Model CM,
42 CodeGenOpt::Level OL);
Tony Linthicum1213a7a2011-12-12 21:14:40 +000043
Craig Topper906c2cd2014-04-29 07:58:16 +000044 const HexagonInstrInfo *getInstrInfo() const override {
Tony Linthicum1213a7a2011-12-12 21:14:40 +000045 return &InstrInfo;
46 }
Craig Topper906c2cd2014-04-29 07:58:16 +000047 const HexagonSubtarget *getSubtargetImpl() const override {
Tony Linthicum1213a7a2011-12-12 21:14:40 +000048 return &Subtarget;
49 }
Craig Topper906c2cd2014-04-29 07:58:16 +000050 const HexagonRegisterInfo *getRegisterInfo() const override {
Tony Linthicum1213a7a2011-12-12 21:14:40 +000051 return &InstrInfo.getRegisterInfo();
52 }
53
Craig Topper906c2cd2014-04-29 07:58:16 +000054 const InstrItineraryData* getInstrItineraryData() const override {
Tony Linthicum1213a7a2011-12-12 21:14:40 +000055 return InstrItins;
56 }
57
58
Craig Topper906c2cd2014-04-29 07:58:16 +000059 const HexagonTargetLowering* getTargetLowering() const override {
Tony Linthicum1213a7a2011-12-12 21:14:40 +000060 return &TLInfo;
61 }
62
Craig Topper906c2cd2014-04-29 07:58:16 +000063 const HexagonFrameLowering* getFrameLowering() const override {
Tony Linthicum1213a7a2011-12-12 21:14:40 +000064 return &FrameLowering;
65 }
66
Craig Topper906c2cd2014-04-29 07:58:16 +000067 const HexagonSelectionDAGInfo* getSelectionDAGInfo() const override {
Tony Linthicum1213a7a2011-12-12 21:14:40 +000068 return &TSInfo;
69 }
70
Craig Topper906c2cd2014-04-29 07:58:16 +000071 const DataLayout *getDataLayout() const override { return &DL; }
Tony Linthicum1213a7a2011-12-12 21:14:40 +000072 static unsigned getModuleMatchQuality(const Module &M);
73
74 // Pass Pipeline Configuration.
Craig Topper906c2cd2014-04-29 07:58:16 +000075 virtual bool addPassesForOptimizations(PassManagerBase &PM) final;
76 TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
Tony Linthicum1213a7a2011-12-12 21:14:40 +000077};
78
79extern bool flag_aligned_memcpy;
80
81} // end namespace llvm
82
83#endif