blob: 7ee4474e90e3fc8b392a14dd57930437471b7bfc [file] [log] [blame]
Tony Linthicum1213a7a2011-12-12 21:14:40 +00001//=-- HexagonTargetMachine.h - Define TargetMachine for Hexagon ---*- C++ -*-=//
2//
Chandler Carruth2946cd72019-01-19 08:50:56 +00003// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
Tony Linthicum1213a7a2011-12-12 21:14:40 +00006//
7//===----------------------------------------------------------------------===//
8//
9// This file declares the Hexagon specific subclass of TargetMachine.
10//
11//===----------------------------------------------------------------------===//
12
Benjamin Kramera7c40ef2014-08-13 16:26:38 +000013#ifndef LLVM_LIB_TARGET_HEXAGON_HEXAGONTARGETMACHINE_H
14#define LLVM_LIB_TARGET_HEXAGON_HEXAGONTARGETMACHINE_H
Tony Linthicum1213a7a2011-12-12 21:14:40 +000015
Chandler Carruth802d7552012-12-04 07:12:27 +000016#include "HexagonInstrInfo.h"
Chandler Carruth802d7552012-12-04 07:12:27 +000017#include "HexagonSubtarget.h"
Krzysztof Parzyszek21dc8bd2015-12-18 20:19:30 +000018#include "HexagonTargetObjectFile.h"
Chandler Carruth802d7552012-12-04 07:12:27 +000019#include "llvm/Target/TargetMachine.h"
Tony Linthicum1213a7a2011-12-12 21:14:40 +000020
21namespace llvm {
22
23class Module;
24
Matthias Braunbb8507e2017-10-12 22:57:28 +000025class HexagonTargetMachine : public LLVMTargetMachine {
Aditya Nandakumara2719322014-11-13 09:26:31 +000026 std::unique_ptr<TargetLoweringObjectFile> TLOF;
Krzysztof Parzyszek73e66f32015-08-05 18:35:37 +000027 mutable StringMap<std::unique_ptr<HexagonSubtarget>> SubtargetMap;
Tony Linthicum1213a7a2011-12-12 21:14:40 +000028
29public:
Daniel Sanders3e5de882015-06-11 19:41:26 +000030 HexagonTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
Craig Topperb5454082012-03-17 09:24:09 +000031 StringRef FS, const TargetOptions &Options,
Rafael Espindola79e238a2017-08-03 02:16:21 +000032 Optional<Reloc::Model> RM, Optional<CodeModel::Model> CM,
33 CodeGenOpt::Level OL, bool JIT);
Reid Kleckner357600e2014-11-20 23:37:18 +000034 ~HexagonTargetMachine() override;
Krzysztof Parzyszek73e66f32015-08-05 18:35:37 +000035 const HexagonSubtarget *getSubtargetImpl(const Function &F) const override;
36
Tony Linthicum1213a7a2011-12-12 21:14:40 +000037 static unsigned getModuleMatchQuality(const Module &M);
38
Krzysztof Parzyszekc8b94382017-01-26 21:41:10 +000039 void adjustPassManager(PassManagerBuilder &PMB) override;
Craig Topper906c2cd2014-04-29 07:58:16 +000040 TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
Sanjoy Das26d11ca2017-12-22 18:21:59 +000041 TargetTransformInfo getTargetTransformInfo(const Function &F) override;
Aditya Nandakumara2719322014-11-13 09:26:31 +000042
Krzysztof Parzyszek21dc8bd2015-12-18 20:19:30 +000043 HexagonTargetObjectFile *getObjFileLowering() const override {
44 return static_cast<HexagonTargetObjectFile*>(TLOF.get());
Aditya Nandakumara2719322014-11-13 09:26:31 +000045 }
Tony Linthicum1213a7a2011-12-12 21:14:40 +000046};
47
Tony Linthicum1213a7a2011-12-12 21:14:40 +000048} // end namespace llvm
49
50#endif