blob: 5264efb89b9c5a8f3e4edb576123c566b7b1c588 [file] [log] [blame]
Tim Northover3b0846e2014-05-24 12:50:23 +00001//==-- AArch64TargetMachine.h - Define TargetMachine for AArch64 -*- 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
Tim Northover3b0846e2014-05-24 12:50:23 +00006//
7//===----------------------------------------------------------------------===//
8//
9// This file declares the AArch64 specific subclass of TargetMachine.
10//
11//===----------------------------------------------------------------------===//
12
Benjamin Kramera7c40ef2014-08-13 16:26:38 +000013#ifndef LLVM_LIB_TARGET_AARCH64_AARCH64TARGETMACHINE_H
14#define LLVM_LIB_TARGET_AARCH64_AARCH64TARGETMACHINE_H
Tim Northover3b0846e2014-05-24 12:50:23 +000015
16#include "AArch64InstrInfo.h"
Tim Northover3b0846e2014-05-24 12:50:23 +000017#include "AArch64Subtarget.h"
Tim Northover3b0846e2014-05-24 12:50:23 +000018#include "llvm/IR/DataLayout.h"
19#include "llvm/Target/TargetMachine.h"
Tim Northover3b0846e2014-05-24 12:50:23 +000020
21namespace llvm {
22
Daniel Sanders0b5293f2017-04-06 09:49:34 +000023class AArch64RegisterBankInfo;
24
Matthias Braunbb8507e2017-10-12 22:57:28 +000025class AArch64TargetMachine : public LLVMTargetMachine {
Tim Northover3b0846e2014-05-24 12:50:23 +000026protected:
Aditya Nandakumara2719322014-11-13 09:26:31 +000027 std::unique_ptr<TargetLoweringObjectFile> TLOF;
Eric Christopher3faf2f12014-10-06 06:45:36 +000028 mutable StringMap<std::unique_ptr<AArch64Subtarget>> SubtargetMap;
Tim Northover3b0846e2014-05-24 12:50:23 +000029
Tim Northover3b0846e2014-05-24 12:50:23 +000030public:
Daniel Sanders3e5de882015-06-11 19:41:26 +000031 AArch64TargetMachine(const Target &T, const Triple &TT, StringRef CPU,
Tim Northover3b0846e2014-05-24 12:50:23 +000032 StringRef FS, const TargetOptions &Options,
Rafael Espindola79e238a2017-08-03 02:16:21 +000033 Optional<Reloc::Model> RM, Optional<CodeModel::Model> CM,
34 CodeGenOpt::Level OL, bool JIT, bool IsLittleEndian);
Tim Northover3b0846e2014-05-24 12:50:23 +000035
Reid Kleckner357600e2014-11-20 23:37:18 +000036 ~AArch64TargetMachine() override;
Eric Christopher3faf2f12014-10-06 06:45:36 +000037 const AArch64Subtarget *getSubtargetImpl(const Function &F) const override;
Eric Christopher97ae58682017-07-25 22:21:08 +000038 // DO NOT IMPLEMENT: There is no such thing as a valid default subtarget,
39 // subtargets are per-function entities based on the target-specific
40 // attributes of each function.
Eric Christopherb4fb2562017-06-30 19:49:05 +000041 const AArch64Subtarget *getSubtargetImpl() const = delete;
Tim Northover3b0846e2014-05-24 12:50:23 +000042
43 // Pass Pipeline Configuration
44 TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
45
Sanjoy Das26d11ca2017-12-22 18:21:59 +000046 TargetTransformInfo getTargetTransformInfo(const Function &F) override;
Arnaud A. de Grandmaisonc75dbbb2014-09-10 14:06:10 +000047
Aditya Nandakumara2719322014-11-13 09:26:31 +000048 TargetLoweringObjectFile* getObjFileLowering() const override {
49 return TLOF.get();
50 }
51
Arnaud A. de Grandmaisonc75dbbb2014-09-10 14:06:10 +000052private:
Evandro Menezesba4926e2016-09-20 19:02:06 +000053 bool isLittle;
Tim Northover3b0846e2014-05-24 12:50:23 +000054};
55
Rafael Espindola38af4d62016-05-18 16:00:24 +000056// AArch64 little endian target machine.
Tim Northover3b0846e2014-05-24 12:50:23 +000057//
58class AArch64leTargetMachine : public AArch64TargetMachine {
59 virtual void anchor();
60public:
Daniel Sanders3e5de882015-06-11 19:41:26 +000061 AArch64leTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
Tim Northover3b0846e2014-05-24 12:50:23 +000062 StringRef FS, const TargetOptions &Options,
Rafael Espindola79e238a2017-08-03 02:16:21 +000063 Optional<Reloc::Model> RM,
64 Optional<CodeModel::Model> CM, CodeGenOpt::Level OL,
65 bool JIT);
Tim Northover3b0846e2014-05-24 12:50:23 +000066};
67
Rafael Espindola38af4d62016-05-18 16:00:24 +000068// AArch64 big endian target machine.
Tim Northover3b0846e2014-05-24 12:50:23 +000069//
70class AArch64beTargetMachine : public AArch64TargetMachine {
71 virtual void anchor();
72public:
Daniel Sanders3e5de882015-06-11 19:41:26 +000073 AArch64beTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
Tim Northover3b0846e2014-05-24 12:50:23 +000074 StringRef FS, const TargetOptions &Options,
Rafael Espindola79e238a2017-08-03 02:16:21 +000075 Optional<Reloc::Model> RM,
76 Optional<CodeModel::Model> CM, CodeGenOpt::Level OL,
77 bool JIT);
Tim Northover3b0846e2014-05-24 12:50:23 +000078};
79
80} // end namespace llvm
81
82#endif