blob: 8d28a5e30ebfaa0610f9b37ed597d906985e2329 [file] [log] [blame]
Tim Northover3b0846e2014-05-24 12:50:23 +00001//==-- AArch64TargetMachine.h - Define TargetMachine for AArch64 -*- 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 AArch64 specific subclass of TargetMachine.
11//
12//===----------------------------------------------------------------------===//
13
Benjamin Kramera7c40ef2014-08-13 16:26:38 +000014#ifndef LLVM_LIB_TARGET_AARCH64_AARCH64TARGETMACHINE_H
15#define LLVM_LIB_TARGET_AARCH64_AARCH64TARGETMACHINE_H
Tim Northover3b0846e2014-05-24 12:50:23 +000016
17#include "AArch64InstrInfo.h"
Tim Northover3b0846e2014-05-24 12:50:23 +000018#include "AArch64Subtarget.h"
Tim Northover3b0846e2014-05-24 12:50:23 +000019#include "llvm/IR/DataLayout.h"
20#include "llvm/Target/TargetMachine.h"
Tim Northover3b0846e2014-05-24 12:50:23 +000021
22namespace llvm {
23
Daniel Sanders0b5293f2017-04-06 09:49:34 +000024class AArch64RegisterBankInfo;
25
Matthias Braunbb8507e2017-10-12 22:57:28 +000026class AArch64TargetMachine : public LLVMTargetMachine {
Tim Northover3b0846e2014-05-24 12:50:23 +000027protected:
Aditya Nandakumara2719322014-11-13 09:26:31 +000028 std::unique_ptr<TargetLoweringObjectFile> TLOF;
Eric Christopher3faf2f12014-10-06 06:45:36 +000029 mutable StringMap<std::unique_ptr<AArch64Subtarget>> SubtargetMap;
Tim Northover3b0846e2014-05-24 12:50:23 +000030
Tim Northover3b0846e2014-05-24 12:50:23 +000031public:
Daniel Sanders3e5de882015-06-11 19:41:26 +000032 AArch64TargetMachine(const Target &T, const Triple &TT, StringRef CPU,
Tim Northover3b0846e2014-05-24 12:50:23 +000033 StringRef FS, const TargetOptions &Options,
Rafael Espindola79e238a2017-08-03 02:16:21 +000034 Optional<Reloc::Model> RM, Optional<CodeModel::Model> CM,
35 CodeGenOpt::Level OL, bool JIT, bool IsLittleEndian);
Tim Northover3b0846e2014-05-24 12:50:23 +000036
Reid Kleckner357600e2014-11-20 23:37:18 +000037 ~AArch64TargetMachine() override;
Eric Christopher3faf2f12014-10-06 06:45:36 +000038 const AArch64Subtarget *getSubtargetImpl(const Function &F) const override;
Eric Christopher97ae58682017-07-25 22:21:08 +000039 // DO NOT IMPLEMENT: There is no such thing as a valid default subtarget,
40 // subtargets are per-function entities based on the target-specific
41 // attributes of each function.
Eric Christopherb4fb2562017-06-30 19:49:05 +000042 const AArch64Subtarget *getSubtargetImpl() const = delete;
Tim Northover3b0846e2014-05-24 12:50:23 +000043
44 // Pass Pipeline Configuration
45 TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
46
Sanjoy Das26d11ca2017-12-22 18:21:59 +000047 TargetTransformInfo getTargetTransformInfo(const Function &F) override;
Arnaud A. de Grandmaisonc75dbbb2014-09-10 14:06:10 +000048
Aditya Nandakumara2719322014-11-13 09:26:31 +000049 TargetLoweringObjectFile* getObjFileLowering() const override {
50 return TLOF.get();
51 }
52
Arnaud A. de Grandmaisonc75dbbb2014-09-10 14:06:10 +000053private:
Evandro Menezesba4926e2016-09-20 19:02:06 +000054 bool isLittle;
Tim Northover3b0846e2014-05-24 12:50:23 +000055};
56
Rafael Espindola38af4d62016-05-18 16:00:24 +000057// AArch64 little endian target machine.
Tim Northover3b0846e2014-05-24 12:50:23 +000058//
59class AArch64leTargetMachine : public AArch64TargetMachine {
60 virtual void anchor();
61public:
Daniel Sanders3e5de882015-06-11 19:41:26 +000062 AArch64leTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
Tim Northover3b0846e2014-05-24 12:50:23 +000063 StringRef FS, const TargetOptions &Options,
Rafael Espindola79e238a2017-08-03 02:16:21 +000064 Optional<Reloc::Model> RM,
65 Optional<CodeModel::Model> CM, CodeGenOpt::Level OL,
66 bool JIT);
Tim Northover3b0846e2014-05-24 12:50:23 +000067};
68
Rafael Espindola38af4d62016-05-18 16:00:24 +000069// AArch64 big endian target machine.
Tim Northover3b0846e2014-05-24 12:50:23 +000070//
71class AArch64beTargetMachine : public AArch64TargetMachine {
72 virtual void anchor();
73public:
Daniel Sanders3e5de882015-06-11 19:41:26 +000074 AArch64beTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
Tim Northover3b0846e2014-05-24 12:50:23 +000075 StringRef FS, const TargetOptions &Options,
Rafael Espindola79e238a2017-08-03 02:16:21 +000076 Optional<Reloc::Model> RM,
77 Optional<CodeModel::Model> CM, CodeGenOpt::Level OL,
78 bool JIT);
Tim Northover3b0846e2014-05-24 12:50:23 +000079};
80
81} // end namespace llvm
82
83#endif