blob: 2072bb731f0a0e43b8ecc4814ede9523662c53f2 [file] [log] [blame]
Rafael Espindolaffdc24b2006-05-14 22:18:28 +00001//===-- ARMTargetMachine.h - Define TargetMachine for ARM -------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
Chris Lattnerf3ebc3f2007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
Rafael Espindolaffdc24b2006-05-14 22:18:28 +00006// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file declares the ARM specific subclass of TargetMachine.
11//
12//===----------------------------------------------------------------------===//
13
Benjamin Kramera7c40ef2014-08-13 16:26:38 +000014#ifndef LLVM_LIB_TARGET_ARM_ARMTARGETMACHINE_H
15#define LLVM_LIB_TARGET_ARM_ARMTARGETMACHINE_H
Rafael Espindolaffdc24b2006-05-14 22:18:28 +000016
Chandler Carruth802d7552012-12-04 07:12:27 +000017#include "ARMSubtarget.h"
Eugene Zelenko342257e2017-01-31 00:56:17 +000018#include "llvm/ADT/Optional.h"
19#include "llvm/ADT/StringMap.h"
20#include "llvm/ADT/StringRef.h"
21#include "llvm/Analysis/TargetTransformInfo.h"
22#include "llvm/Support/CodeGen.h"
Chandler Carruth802d7552012-12-04 07:12:27 +000023#include "llvm/Target/TargetMachine.h"
Eugene Zelenko342257e2017-01-31 00:56:17 +000024#include <memory>
Rafael Espindolaffdc24b2006-05-14 22:18:28 +000025
26namespace llvm {
27
Matthias Braunbb8507e2017-10-12 22:57:28 +000028class ARMBaseTargetMachine : public LLVMTargetMachine {
Eric Christopher661f2d12014-12-18 02:20:58 +000029public:
30 enum ARMABI {
31 ARM_ABI_UNKNOWN,
32 ARM_ABI_APCS,
Tim Northovere0ccdc62015-10-28 22:46:43 +000033 ARM_ABI_AAPCS, // ARM EABI
34 ARM_ABI_AAPCS16
Eric Christopher661f2d12014-12-18 02:20:58 +000035 } TargetABI;
36
Anton Korobeynikov99152f32009-06-26 21:28:53 +000037protected:
Aditya Nandakumara2719322014-11-13 09:26:31 +000038 std::unique_ptr<TargetLoweringObjectFile> TLOF;
Eric Christopher3faf2f12014-10-06 06:45:36 +000039 bool isLittle;
40 mutable StringMap<std::unique_ptr<ARMSubtarget>> SubtargetMap;
41
Rafael Espindolaffdc24b2006-05-14 22:18:28 +000042public:
Daniel Sanders3e5de882015-06-11 19:41:26 +000043 ARMBaseTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
44 StringRef FS, const TargetOptions &Options,
Rafael Espindola79e238a2017-08-03 02:16:21 +000045 Optional<Reloc::Model> RM, Optional<CodeModel::Model> CM,
Daniel Sanders3e5de882015-06-11 19:41:26 +000046 CodeGenOpt::Level OL, bool isLittle);
Reid Kleckner357600e2014-11-20 23:37:18 +000047 ~ARMBaseTargetMachine() override;
Rafael Espindolaffdc24b2006-05-14 22:18:28 +000048
Eric Christopher3faf2f12014-10-06 06:45:36 +000049 const ARMSubtarget *getSubtargetImpl(const Function &F) const override;
Eric Christopher97ae58682017-07-25 22:21:08 +000050 // DO NOT IMPLEMENT: There is no such thing as a valid default subtarget,
51 // subtargets are per-function entities based on the target-specific
52 // attributes of each function.
Eric Christopher3df231a2017-07-01 03:41:53 +000053 const ARMSubtarget *getSubtargetImpl() const = delete;
Eric Christophera49d68e2015-02-17 20:02:32 +000054 bool isLittleEndian() const { return isLittle; }
Eric Christopher3d19f132014-06-18 22:48:09 +000055
Sanjoy Das26d11ca2017-12-22 18:21:59 +000056 TargetTransformInfo getTargetTransformInfo(const Function &F) override;
Chandler Carruth664e3542013-01-07 01:37:14 +000057
Chris Lattner12e97302006-09-04 04:14:57 +000058 // Pass Pipeline Configuration
Craig Topper6bc27bf2014-03-10 02:09:33 +000059 TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
Aditya Nandakumara2719322014-11-13 09:26:31 +000060
61 TargetLoweringObjectFile *getObjFileLowering() const override {
62 return TLOF.get();
63 }
Rafael Espindolaffdc24b2006-05-14 22:18:28 +000064};
65
Florian Hahnd211fe72017-05-24 10:18:57 +000066/// ARM/Thumb little endian target machine.
Anton Korobeynikov99152f32009-06-26 21:28:53 +000067///
Florian Hahnd211fe72017-05-24 10:18:57 +000068class ARMLETargetMachine : public ARMBaseTargetMachine {
Christian Pirker2a111602014-03-28 14:35:30 +000069public:
Daniel Sanders3e5de882015-06-11 19:41:26 +000070 ARMLETargetMachine(const Target &T, const Triple &TT, StringRef CPU,
71 StringRef FS, const TargetOptions &Options,
Rafael Espindola79e238a2017-08-03 02:16:21 +000072 Optional<Reloc::Model> RM, Optional<CodeModel::Model> CM,
73 CodeGenOpt::Level OL, bool JIT);
Christian Pirker2a111602014-03-28 14:35:30 +000074};
75
Florian Hahnd211fe72017-05-24 10:18:57 +000076/// ARM/Thumb big endian target machine.
Christian Pirker2a111602014-03-28 14:35:30 +000077///
Florian Hahnd211fe72017-05-24 10:18:57 +000078class ARMBETargetMachine : public ARMBaseTargetMachine {
Christian Pirker2a111602014-03-28 14:35:30 +000079public:
Daniel Sanders3e5de882015-06-11 19:41:26 +000080 ARMBETargetMachine(const Target &T, const Triple &TT, StringRef CPU,
81 StringRef FS, const TargetOptions &Options,
Rafael Espindola79e238a2017-08-03 02:16:21 +000082 Optional<Reloc::Model> RM, Optional<CodeModel::Model> CM,
83 CodeGenOpt::Level OL, bool JIT);
Christian Pirker2a111602014-03-28 14:35:30 +000084};
85
Rafael Espindolaffdc24b2006-05-14 22:18:28 +000086} // end namespace llvm
87
Eugene Zelenko342257e2017-01-31 00:56:17 +000088#endif // LLVM_LIB_TARGET_ARM_ARMTARGETMACHINE_H