blob: 75c65c57905fa744f4d2ac2e8bf811cfda0864f2 [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:
Aditya Nandakumara2719322014-11-13 09:26:31 +000026 std::unique_ptr<TargetLoweringObjectFile> TLOF;
Tim Northover3b0846e2014-05-24 12:50:23 +000027 AArch64Subtarget Subtarget;
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:
31 AArch64TargetMachine(const Target &T, StringRef TT, StringRef CPU,
32 StringRef FS, const TargetOptions &Options,
33 Reloc::Model RM, CodeModel::Model CM,
34 CodeGenOpt::Level OL, bool IsLittleEndian);
35
Reid Kleckner357600e2014-11-20 23:37:18 +000036 ~AArch64TargetMachine() override;
37
Tim Northover3b0846e2014-05-24 12:50:23 +000038 const AArch64Subtarget *getSubtargetImpl() const override {
39 return &Subtarget;
40 }
Eric Christopher3faf2f12014-10-06 06:45:36 +000041 const AArch64Subtarget *getSubtargetImpl(const Function &F) const override;
Tim Northover3b0846e2014-05-24 12:50:23 +000042
43 // Pass Pipeline Configuration
44 TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
45
46 /// \brief Register AArch64 analysis passes with a pass manager.
47 void addAnalysisPasses(PassManagerBase &PM) 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:
Eric Christopher3faf2f12014-10-06 06:45:36 +000054 bool isLittle;
Tim Northover3b0846e2014-05-24 12:50:23 +000055};
56
57// AArch64leTargetMachine - AArch64 little endian target machine.
58//
59class AArch64leTargetMachine : public AArch64TargetMachine {
60 virtual void anchor();
61public:
62 AArch64leTargetMachine(const Target &T, StringRef TT, StringRef CPU,
63 StringRef FS, const TargetOptions &Options,
64 Reloc::Model RM, CodeModel::Model CM,
65 CodeGenOpt::Level OL);
66};
67
68// AArch64beTargetMachine - AArch64 big endian target machine.
69//
70class AArch64beTargetMachine : public AArch64TargetMachine {
71 virtual void anchor();
72public:
73 AArch64beTargetMachine(const Target &T, StringRef TT, StringRef CPU,
74 StringRef FS, const TargetOptions &Options,
75 Reloc::Model RM, CodeModel::Model CM,
76 CodeGenOpt::Level OL);
77};
78
79} // end namespace llvm
80
81#endif