blob: 7143adf6c095af6d83272f6fa2d095cc11e82661 [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
24class AArch64TargetMachine : public LLVMTargetMachine {
25protected:
Eric Christopher8b770652015-01-26 19:03:15 +000026 const DataLayout DL;
Aditya Nandakumara2719322014-11-13 09:26:31 +000027 std::unique_ptr<TargetLoweringObjectFile> TLOF;
Tim Northover3b0846e2014-05-24 12:50:23 +000028 AArch64Subtarget Subtarget;
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:
32 AArch64TargetMachine(const Target &T, StringRef TT, StringRef CPU,
33 StringRef FS, const TargetOptions &Options,
34 Reloc::Model RM, CodeModel::Model CM,
35 CodeGenOpt::Level OL, bool IsLittleEndian);
36
Reid Kleckner357600e2014-11-20 23:37:18 +000037 ~AArch64TargetMachine() override;
38
Eric Christopher8b770652015-01-26 19:03:15 +000039 const DataLayout *getDataLayout() const override { return &DL; }
Tim Northover3b0846e2014-05-24 12:50:23 +000040 const AArch64Subtarget *getSubtargetImpl() const override {
41 return &Subtarget;
42 }
Eric Christopher3faf2f12014-10-06 06:45:36 +000043 const AArch64Subtarget *getSubtargetImpl(const Function &F) const override;
Tim Northover3b0846e2014-05-24 12:50:23 +000044
45 // Pass Pipeline Configuration
46 TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
47
Chandler Carruth8b04c0d2015-02-01 13:20:00 +000048 /// \brief Get the TargetIRAnalysis for this target.
49 TargetIRAnalysis getTargetIRAnalysis() override;
Arnaud A. de Grandmaisonc75dbbb2014-09-10 14:06:10 +000050
Aditya Nandakumara2719322014-11-13 09:26:31 +000051 TargetLoweringObjectFile* getObjFileLowering() const override {
52 return TLOF.get();
53 }
54
Arnaud A. de Grandmaisonc75dbbb2014-09-10 14:06:10 +000055private:
Eric Christopher3faf2f12014-10-06 06:45:36 +000056 bool isLittle;
Tim Northover3b0846e2014-05-24 12:50:23 +000057};
58
59// AArch64leTargetMachine - AArch64 little endian target machine.
60//
61class AArch64leTargetMachine : public AArch64TargetMachine {
62 virtual void anchor();
63public:
64 AArch64leTargetMachine(const Target &T, StringRef TT, StringRef CPU,
65 StringRef FS, const TargetOptions &Options,
66 Reloc::Model RM, CodeModel::Model CM,
67 CodeGenOpt::Level OL);
68};
69
70// AArch64beTargetMachine - AArch64 big endian target machine.
71//
72class AArch64beTargetMachine : public AArch64TargetMachine {
73 virtual void anchor();
74public:
75 AArch64beTargetMachine(const Target &T, StringRef TT, StringRef CPU,
76 StringRef FS, const TargetOptions &Options,
77 Reloc::Model RM, CodeModel::Model CM,
78 CodeGenOpt::Level OL);
79};
80
81} // end namespace llvm
82
83#endif