| Tim Northover | 3b0846e | 2014-05-24 12:50:23 +0000 | [diff] [blame] | 1 | //==-- AArch64TargetMachine.h - Define TargetMachine for AArch64 -*- C++ -*-==// |
| 2 | // |
| Chandler Carruth | 2946cd7 | 2019-01-19 08:50:56 +0000 | [diff] [blame^] | 3 | // 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 Northover | 3b0846e | 2014-05-24 12:50:23 +0000 | [diff] [blame] | 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | // |
| 9 | // This file declares the AArch64 specific subclass of TargetMachine. |
| 10 | // |
| 11 | //===----------------------------------------------------------------------===// |
| 12 | |
| Benjamin Kramer | a7c40ef | 2014-08-13 16:26:38 +0000 | [diff] [blame] | 13 | #ifndef LLVM_LIB_TARGET_AARCH64_AARCH64TARGETMACHINE_H |
| 14 | #define LLVM_LIB_TARGET_AARCH64_AARCH64TARGETMACHINE_H |
| Tim Northover | 3b0846e | 2014-05-24 12:50:23 +0000 | [diff] [blame] | 15 | |
| 16 | #include "AArch64InstrInfo.h" |
| Tim Northover | 3b0846e | 2014-05-24 12:50:23 +0000 | [diff] [blame] | 17 | #include "AArch64Subtarget.h" |
| Tim Northover | 3b0846e | 2014-05-24 12:50:23 +0000 | [diff] [blame] | 18 | #include "llvm/IR/DataLayout.h" |
| 19 | #include "llvm/Target/TargetMachine.h" |
| Tim Northover | 3b0846e | 2014-05-24 12:50:23 +0000 | [diff] [blame] | 20 | |
| 21 | namespace llvm { |
| 22 | |
| Daniel Sanders | 0b5293f | 2017-04-06 09:49:34 +0000 | [diff] [blame] | 23 | class AArch64RegisterBankInfo; |
| 24 | |
| Matthias Braun | bb8507e | 2017-10-12 22:57:28 +0000 | [diff] [blame] | 25 | class AArch64TargetMachine : public LLVMTargetMachine { |
| Tim Northover | 3b0846e | 2014-05-24 12:50:23 +0000 | [diff] [blame] | 26 | protected: |
| Aditya Nandakumar | a271932 | 2014-11-13 09:26:31 +0000 | [diff] [blame] | 27 | std::unique_ptr<TargetLoweringObjectFile> TLOF; |
| Eric Christopher | 3faf2f1 | 2014-10-06 06:45:36 +0000 | [diff] [blame] | 28 | mutable StringMap<std::unique_ptr<AArch64Subtarget>> SubtargetMap; |
| Tim Northover | 3b0846e | 2014-05-24 12:50:23 +0000 | [diff] [blame] | 29 | |
| Tim Northover | 3b0846e | 2014-05-24 12:50:23 +0000 | [diff] [blame] | 30 | public: |
| Daniel Sanders | 3e5de88 | 2015-06-11 19:41:26 +0000 | [diff] [blame] | 31 | AArch64TargetMachine(const Target &T, const Triple &TT, StringRef CPU, |
| Tim Northover | 3b0846e | 2014-05-24 12:50:23 +0000 | [diff] [blame] | 32 | StringRef FS, const TargetOptions &Options, |
| Rafael Espindola | 79e238a | 2017-08-03 02:16:21 +0000 | [diff] [blame] | 33 | Optional<Reloc::Model> RM, Optional<CodeModel::Model> CM, |
| 34 | CodeGenOpt::Level OL, bool JIT, bool IsLittleEndian); |
| Tim Northover | 3b0846e | 2014-05-24 12:50:23 +0000 | [diff] [blame] | 35 | |
| Reid Kleckner | 357600e | 2014-11-20 23:37:18 +0000 | [diff] [blame] | 36 | ~AArch64TargetMachine() override; |
| Eric Christopher | 3faf2f1 | 2014-10-06 06:45:36 +0000 | [diff] [blame] | 37 | const AArch64Subtarget *getSubtargetImpl(const Function &F) const override; |
| Eric Christopher | 97ae5868 | 2017-07-25 22:21:08 +0000 | [diff] [blame] | 38 | // 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 Christopher | b4fb256 | 2017-06-30 19:49:05 +0000 | [diff] [blame] | 41 | const AArch64Subtarget *getSubtargetImpl() const = delete; |
| Tim Northover | 3b0846e | 2014-05-24 12:50:23 +0000 | [diff] [blame] | 42 | |
| 43 | // Pass Pipeline Configuration |
| 44 | TargetPassConfig *createPassConfig(PassManagerBase &PM) override; |
| 45 | |
| Sanjoy Das | 26d11ca | 2017-12-22 18:21:59 +0000 | [diff] [blame] | 46 | TargetTransformInfo getTargetTransformInfo(const Function &F) override; |
| Arnaud A. de Grandmaison | c75dbbb | 2014-09-10 14:06:10 +0000 | [diff] [blame] | 47 | |
| Aditya Nandakumar | a271932 | 2014-11-13 09:26:31 +0000 | [diff] [blame] | 48 | TargetLoweringObjectFile* getObjFileLowering() const override { |
| 49 | return TLOF.get(); |
| 50 | } |
| 51 | |
| Arnaud A. de Grandmaison | c75dbbb | 2014-09-10 14:06:10 +0000 | [diff] [blame] | 52 | private: |
| Evandro Menezes | ba4926e | 2016-09-20 19:02:06 +0000 | [diff] [blame] | 53 | bool isLittle; |
| Tim Northover | 3b0846e | 2014-05-24 12:50:23 +0000 | [diff] [blame] | 54 | }; |
| 55 | |
| Rafael Espindola | 38af4d6 | 2016-05-18 16:00:24 +0000 | [diff] [blame] | 56 | // AArch64 little endian target machine. |
| Tim Northover | 3b0846e | 2014-05-24 12:50:23 +0000 | [diff] [blame] | 57 | // |
| 58 | class AArch64leTargetMachine : public AArch64TargetMachine { |
| 59 | virtual void anchor(); |
| 60 | public: |
| Daniel Sanders | 3e5de88 | 2015-06-11 19:41:26 +0000 | [diff] [blame] | 61 | AArch64leTargetMachine(const Target &T, const Triple &TT, StringRef CPU, |
| Tim Northover | 3b0846e | 2014-05-24 12:50:23 +0000 | [diff] [blame] | 62 | StringRef FS, const TargetOptions &Options, |
| Rafael Espindola | 79e238a | 2017-08-03 02:16:21 +0000 | [diff] [blame] | 63 | Optional<Reloc::Model> RM, |
| 64 | Optional<CodeModel::Model> CM, CodeGenOpt::Level OL, |
| 65 | bool JIT); |
| Tim Northover | 3b0846e | 2014-05-24 12:50:23 +0000 | [diff] [blame] | 66 | }; |
| 67 | |
| Rafael Espindola | 38af4d6 | 2016-05-18 16:00:24 +0000 | [diff] [blame] | 68 | // AArch64 big endian target machine. |
| Tim Northover | 3b0846e | 2014-05-24 12:50:23 +0000 | [diff] [blame] | 69 | // |
| 70 | class AArch64beTargetMachine : public AArch64TargetMachine { |
| 71 | virtual void anchor(); |
| 72 | public: |
| Daniel Sanders | 3e5de88 | 2015-06-11 19:41:26 +0000 | [diff] [blame] | 73 | AArch64beTargetMachine(const Target &T, const Triple &TT, StringRef CPU, |
| Tim Northover | 3b0846e | 2014-05-24 12:50:23 +0000 | [diff] [blame] | 74 | StringRef FS, const TargetOptions &Options, |
| Rafael Espindola | 79e238a | 2017-08-03 02:16:21 +0000 | [diff] [blame] | 75 | Optional<Reloc::Model> RM, |
| 76 | Optional<CodeModel::Model> CM, CodeGenOpt::Level OL, |
| 77 | bool JIT); |
| Tim Northover | 3b0846e | 2014-05-24 12:50:23 +0000 | [diff] [blame] | 78 | }; |
| 79 | |
| 80 | } // end namespace llvm |
| 81 | |
| 82 | #endif |