blob: c6b70b953162650d875cf17a0e9f5c6f59be1e65 [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 "ARMInstrInfo.h"
Chandler Carruth802d7552012-12-04 07:12:27 +000018#include "ARMSubtarget.h"
Chandler Carruth9fb823b2013-01-02 11:36:10 +000019#include "llvm/IR/DataLayout.h"
Chandler Carruth802d7552012-12-04 07:12:27 +000020#include "llvm/Target/TargetMachine.h"
Rafael Espindolaffdc24b2006-05-14 22:18:28 +000021
22namespace llvm {
23
Anton Korobeynikov99152f32009-06-26 21:28:53 +000024class ARMBaseTargetMachine : public LLVMTargetMachine {
Eric Christopher661f2d12014-12-18 02:20:58 +000025public:
26 enum ARMABI {
27 ARM_ABI_UNKNOWN,
28 ARM_ABI_APCS,
Tim Northovere0ccdc62015-10-28 22:46:43 +000029 ARM_ABI_AAPCS, // ARM EABI
30 ARM_ABI_AAPCS16
Eric Christopher661f2d12014-12-18 02:20:58 +000031 } TargetABI;
32
Anton Korobeynikov99152f32009-06-26 21:28:53 +000033protected:
Aditya Nandakumara2719322014-11-13 09:26:31 +000034 std::unique_ptr<TargetLoweringObjectFile> TLOF;
Evan Cheng4e712de2009-06-19 01:51:50 +000035 ARMSubtarget Subtarget;
Eric Christopher3faf2f12014-10-06 06:45:36 +000036 bool isLittle;
37 mutable StringMap<std::unique_ptr<ARMSubtarget>> SubtargetMap;
38
Rafael Espindolaffdc24b2006-05-14 22:18:28 +000039public:
Daniel Sanders3e5de882015-06-11 19:41:26 +000040 ARMBaseTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
41 StringRef FS, const TargetOptions &Options,
Rafael Espindola8c34dd82016-05-18 22:04:49 +000042 Optional<Reloc::Model> RM, CodeModel::Model CM,
Daniel Sanders3e5de882015-06-11 19:41:26 +000043 CodeGenOpt::Level OL, bool isLittle);
Reid Kleckner357600e2014-11-20 23:37:18 +000044 ~ARMBaseTargetMachine() override;
Rafael Espindolaffdc24b2006-05-14 22:18:28 +000045
Eric Christopher4d0f35a2015-03-21 04:22:23 +000046 const ARMSubtarget *getSubtargetImpl() const { return &Subtarget; }
Eric Christopher3faf2f12014-10-06 06:45:36 +000047 const ARMSubtarget *getSubtargetImpl(const Function &F) const override;
Eric Christophera49d68e2015-02-17 20:02:32 +000048 bool isLittleEndian() const { return isLittle; }
Eric Christopher3d19f132014-06-18 22:48:09 +000049
Chandler Carruth8b04c0d2015-02-01 13:20:00 +000050 /// \brief Get the TargetIRAnalysis for this target.
51 TargetIRAnalysis getTargetIRAnalysis() override;
Chandler Carruth664e3542013-01-07 01:37:14 +000052
Chris Lattner12e97302006-09-04 04:14:57 +000053 // Pass Pipeline Configuration
Craig Topper6bc27bf2014-03-10 02:09:33 +000054 TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
Aditya Nandakumara2719322014-11-13 09:26:31 +000055
56 TargetLoweringObjectFile *getObjFileLowering() const override {
57 return TLOF.get();
58 }
Rafael Espindolaffdc24b2006-05-14 22:18:28 +000059};
60
Rafael Espindola38af4d62016-05-18 16:00:24 +000061/// ARM target machine.
Anton Korobeynikov99152f32009-06-26 21:28:53 +000062///
63class ARMTargetMachine : public ARMBaseTargetMachine {
David Blaikiea379b1812011-12-20 02:50:00 +000064 virtual void anchor();
Anton Korobeynikovf7183ed2010-11-15 00:06:54 +000065 public:
Daniel Sanders3e5de882015-06-11 19:41:26 +000066 ARMTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
Rafael Espindola8c34dd82016-05-18 22:04:49 +000067 StringRef FS, const TargetOptions &Options,
68 Optional<Reloc::Model> RM, CodeModel::Model CM,
69 CodeGenOpt::Level OL, bool isLittle);
Anton Korobeynikov99152f32009-06-26 21:28:53 +000070};
71
Rafael Espindola38af4d62016-05-18 16:00:24 +000072/// ARM little endian target machine.
Christian Pirker2a111602014-03-28 14:35:30 +000073///
Christian Pirkerdc9ff752014-04-01 15:19:30 +000074class ARMLETargetMachine : public ARMTargetMachine {
Craig Topper9d74a5a2014-04-29 07:58:41 +000075 void anchor() override;
Christian Pirker2a111602014-03-28 14:35:30 +000076public:
Daniel Sanders3e5de882015-06-11 19:41:26 +000077 ARMLETargetMachine(const Target &T, const Triple &TT, StringRef CPU,
78 StringRef FS, const TargetOptions &Options,
Rafael Espindola8c34dd82016-05-18 22:04:49 +000079 Optional<Reloc::Model> RM, CodeModel::Model CM,
Christian Pirker2a111602014-03-28 14:35:30 +000080 CodeGenOpt::Level OL);
81};
82
Rafael Espindola38af4d62016-05-18 16:00:24 +000083/// ARM big endian target machine.
Christian Pirker2a111602014-03-28 14:35:30 +000084///
Christian Pirkerdc9ff752014-04-01 15:19:30 +000085class ARMBETargetMachine : public ARMTargetMachine {
Craig Topper9d74a5a2014-04-29 07:58:41 +000086 void anchor() override;
Christian Pirker2a111602014-03-28 14:35:30 +000087public:
Daniel Sanders3e5de882015-06-11 19:41:26 +000088 ARMBETargetMachine(const Target &T, const Triple &TT, StringRef CPU,
89 StringRef FS, const TargetOptions &Options,
Rafael Espindola8c34dd82016-05-18 22:04:49 +000090 Optional<Reloc::Model> RM, CodeModel::Model CM,
Daniel Sanders3e5de882015-06-11 19:41:26 +000091 CodeGenOpt::Level OL);
Christian Pirker2a111602014-03-28 14:35:30 +000092};
93
Rafael Espindola38af4d62016-05-18 16:00:24 +000094/// Thumb target machine.
David Goodwinade05a32009-07-02 22:18:33 +000095/// Due to the way architectures are handled, this represents both
96/// Thumb-1 and Thumb-2.
Evan Cheng9f830142007-02-23 03:14:31 +000097///
Anton Korobeynikov99152f32009-06-26 21:28:53 +000098class ThumbTargetMachine : public ARMBaseTargetMachine {
David Blaikiea379b1812011-12-20 02:50:00 +000099 virtual void anchor();
Evan Cheng9f830142007-02-23 03:14:31 +0000100public:
Daniel Sanders3e5de882015-06-11 19:41:26 +0000101 ThumbTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
102 StringRef FS, const TargetOptions &Options,
Rafael Espindola8c34dd82016-05-18 22:04:49 +0000103 Optional<Reloc::Model> RM, CodeModel::Model CM,
104 CodeGenOpt::Level OL, bool isLittle);
Evan Cheng9f830142007-02-23 03:14:31 +0000105};
106
Rafael Espindola38af4d62016-05-18 16:00:24 +0000107/// Thumb little endian target machine.
Christian Pirker2a111602014-03-28 14:35:30 +0000108///
Christian Pirkerdc9ff752014-04-01 15:19:30 +0000109class ThumbLETargetMachine : public ThumbTargetMachine {
Craig Topper9d74a5a2014-04-29 07:58:41 +0000110 void anchor() override;
Christian Pirker2a111602014-03-28 14:35:30 +0000111public:
Daniel Sanders3e5de882015-06-11 19:41:26 +0000112 ThumbLETargetMachine(const Target &T, const Triple &TT, StringRef CPU,
Eric Christopher80b24ef2014-06-26 19:30:02 +0000113 StringRef FS, const TargetOptions &Options,
Rafael Espindola8c34dd82016-05-18 22:04:49 +0000114 Optional<Reloc::Model> RM, CodeModel::Model CM,
Eric Christopher80b24ef2014-06-26 19:30:02 +0000115 CodeGenOpt::Level OL);
Christian Pirker2a111602014-03-28 14:35:30 +0000116};
117
Rafael Espindola38af4d62016-05-18 16:00:24 +0000118/// Thumb big endian target machine.
Christian Pirker2a111602014-03-28 14:35:30 +0000119///
Christian Pirkerdc9ff752014-04-01 15:19:30 +0000120class ThumbBETargetMachine : public ThumbTargetMachine {
Craig Topper9d74a5a2014-04-29 07:58:41 +0000121 void anchor() override;
Christian Pirker2a111602014-03-28 14:35:30 +0000122public:
Daniel Sanders3e5de882015-06-11 19:41:26 +0000123 ThumbBETargetMachine(const Target &T, const Triple &TT, StringRef CPU,
Jim Grosbachbb1af942014-04-03 23:43:22 +0000124 StringRef FS, const TargetOptions &Options,
Rafael Espindola8c34dd82016-05-18 22:04:49 +0000125 Optional<Reloc::Model> RM, CodeModel::Model CM,
Christian Pirker2a111602014-03-28 14:35:30 +0000126 CodeGenOpt::Level OL);
127};
128
Rafael Espindolaffdc24b2006-05-14 22:18:28 +0000129} // end namespace llvm
130
131#endif