2012-02-18 20:03:15 +08:00
|
|
|
//===-- ARMSubtarget.h - Define Subtarget for the ARM ----------*- C++ -*--===//
|
2007-01-19 15:51:42 +08:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-30 04:36:04 +08:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2007-01-19 15:51:42 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
2011-07-02 05:01:15 +08:00
|
|
|
// This file declares the ARM specific subclass of TargetSubtargetInfo.
|
2007-01-19 15:51:42 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2014-08-14 00:26:38 +08:00
|
|
|
#ifndef LLVM_LIB_TARGET_ARM_ARMSUBTARGET_H
|
|
|
|
#define LLVM_LIB_TARGET_ARM_ARMSUBTARGET_H
|
2007-01-19 15:51:42 +08:00
|
|
|
|
2017-01-28 07:58:02 +08:00
|
|
|
#include "ARMBaseInstrInfo.h"
|
|
|
|
#include "ARMBaseRegisterInfo.h"
|
2014-06-27 03:30:02 +08:00
|
|
|
#include "ARMFrameLowering.h"
|
|
|
|
#include "ARMISelLowering.h"
|
2014-06-13 08:20:39 +08:00
|
|
|
#include "ARMSelectionDAGInfo.h"
|
2011-01-12 05:46:47 +08:00
|
|
|
#include "llvm/ADT/Triple.h"
|
2017-08-16 06:31:51 +08:00
|
|
|
#include "llvm/CodeGen/GlobalISel/CallLowering.h"
|
|
|
|
#include "llvm/CodeGen/GlobalISel/InstructionSelector.h"
|
|
|
|
#include "llvm/CodeGen/GlobalISel/LegalizerInfo.h"
|
|
|
|
#include "llvm/CodeGen/GlobalISel/RegisterBankInfo.h"
|
2017-01-28 07:58:02 +08:00
|
|
|
#include "llvm/CodeGen/MachineFunction.h"
|
2012-12-04 15:12:27 +08:00
|
|
|
#include "llvm/MC/MCInstrItineraries.h"
|
2017-01-28 07:58:02 +08:00
|
|
|
#include "llvm/MC/MCSchedule.h"
|
|
|
|
#include "llvm/Target/TargetOptions.h"
|
2012-12-04 15:12:27 +08:00
|
|
|
#include "llvm/Target/TargetSubtargetInfo.h"
|
2017-01-28 07:58:02 +08:00
|
|
|
#include <memory>
|
2007-01-19 15:51:42 +08:00
|
|
|
#include <string>
|
|
|
|
|
2011-07-02 04:45:01 +08:00
|
|
|
#define GET_SUBTARGETINFO_HEADER
|
2011-07-02 06:36:09 +08:00
|
|
|
#include "ARMGenSubtargetInfo.inc"
|
2011-07-02 04:45:01 +08:00
|
|
|
|
2007-01-19 15:51:42 +08:00
|
|
|
namespace llvm {
|
2017-01-28 07:58:02 +08:00
|
|
|
|
|
|
|
class ARMBaseTargetMachine;
|
2009-08-29 07:18:09 +08:00
|
|
|
class GlobalValue;
|
2011-07-07 15:07:08 +08:00
|
|
|
class StringRef;
|
2007-01-19 15:51:42 +08:00
|
|
|
|
2011-07-02 04:45:01 +08:00
|
|
|
class ARMSubtarget : public ARMGenSubtargetInfo {
|
2007-01-19 15:51:42 +08:00
|
|
|
protected:
|
2010-09-10 09:29:16 +08:00
|
|
|
enum ARMProcFamilyEnum {
|
2017-02-10 08:06:44 +08:00
|
|
|
Others,
|
|
|
|
|
|
|
|
CortexA12,
|
|
|
|
CortexA15,
|
|
|
|
CortexA17,
|
|
|
|
CortexA32,
|
|
|
|
CortexA35,
|
|
|
|
CortexA5,
|
|
|
|
CortexA53,
|
2017-08-21 16:43:06 +08:00
|
|
|
CortexA55,
|
2017-02-10 08:06:44 +08:00
|
|
|
CortexA57,
|
|
|
|
CortexA7,
|
|
|
|
CortexA72,
|
|
|
|
CortexA73,
|
2017-08-21 16:43:06 +08:00
|
|
|
CortexA75,
|
2017-02-10 08:06:44 +08:00
|
|
|
CortexA8,
|
|
|
|
CortexA9,
|
|
|
|
CortexM3,
|
|
|
|
CortexR4,
|
|
|
|
CortexR4F,
|
|
|
|
CortexR5,
|
|
|
|
CortexR52,
|
|
|
|
CortexR7,
|
2017-02-10 08:09:20 +08:00
|
|
|
ExynosM1,
|
2017-02-10 08:06:44 +08:00
|
|
|
Krait,
|
2017-04-07 06:47:47 +08:00
|
|
|
Kryo,
|
2017-02-10 08:09:20 +08:00
|
|
|
Swift
|
2010-09-10 09:29:16 +08:00
|
|
|
};
|
2013-09-23 22:26:15 +08:00
|
|
|
enum ARMProcClassEnum {
|
2017-02-10 08:06:44 +08:00
|
|
|
None,
|
|
|
|
|
|
|
|
AClass,
|
|
|
|
MClass,
|
|
|
|
RClass
|
2013-09-23 22:26:15 +08:00
|
|
|
};
|
2015-11-16 19:10:19 +08:00
|
|
|
enum ARMArchEnum {
|
2017-02-10 08:06:44 +08:00
|
|
|
ARMv2,
|
|
|
|
ARMv2a,
|
|
|
|
ARMv3,
|
|
|
|
ARMv3m,
|
|
|
|
ARMv4,
|
|
|
|
ARMv4t,
|
|
|
|
ARMv5,
|
|
|
|
ARMv5t,
|
|
|
|
ARMv5te,
|
|
|
|
ARMv5tej,
|
|
|
|
ARMv6,
|
|
|
|
ARMv6k,
|
|
|
|
ARMv6kz,
|
|
|
|
ARMv6m,
|
|
|
|
ARMv6sm,
|
|
|
|
ARMv6t2,
|
|
|
|
ARMv7a,
|
|
|
|
ARMv7em,
|
|
|
|
ARMv7m,
|
|
|
|
ARMv7r,
|
|
|
|
ARMv7ve,
|
|
|
|
ARMv81a,
|
|
|
|
ARMv82a,
|
2017-08-10 17:41:00 +08:00
|
|
|
ARMv83a,
|
2017-02-10 08:06:44 +08:00
|
|
|
ARMv8a,
|
|
|
|
ARMv8mBaseline,
|
|
|
|
ARMv8mMainline,
|
|
|
|
ARMv8r
|
2015-11-16 19:10:19 +08:00
|
|
|
};
|
2010-09-10 09:29:16 +08:00
|
|
|
|
2016-06-27 17:08:23 +08:00
|
|
|
public:
|
|
|
|
/// What kind of timing do load multiple/store multiple instructions have.
|
|
|
|
enum ARMLdStMultipleTiming {
|
|
|
|
/// Can load/store 2 registers/cycle.
|
|
|
|
DoubleIssue,
|
|
|
|
/// Can load/store 2 registers/cycle, but needs an extra cycle if the access
|
|
|
|
/// is not 64-bit aligned.
|
|
|
|
DoubleIssueCheckUnalignedAccess,
|
|
|
|
/// Can load/store 1 register/cycle.
|
|
|
|
SingleIssue,
|
|
|
|
/// Can load/store 1 register/cycle, but needs an extra cycle for address
|
|
|
|
/// computation and potentially also for register writeback.
|
|
|
|
SingleIssuePlusExtras,
|
|
|
|
};
|
|
|
|
|
|
|
|
protected:
|
2010-09-10 09:29:16 +08:00
|
|
|
/// ARMProcFamily - ARM processor family: Cortex-A8, Cortex-A9, and others.
|
2016-06-27 21:06:10 +08:00
|
|
|
ARMProcFamilyEnum ARMProcFamily = Others;
|
2010-09-10 09:29:16 +08:00
|
|
|
|
2013-09-23 22:26:15 +08:00
|
|
|
/// ARMProcClass - ARM processor class: None, AClass, RClass or MClass.
|
2016-06-27 21:06:10 +08:00
|
|
|
ARMProcClassEnum ARMProcClass = None;
|
2013-09-23 22:26:15 +08:00
|
|
|
|
2015-11-16 19:10:19 +08:00
|
|
|
/// ARMArch - ARM architecture
|
2016-06-27 21:06:10 +08:00
|
|
|
ARMArchEnum ARMArch = ARMv4t;
|
2015-11-16 19:10:19 +08:00
|
|
|
|
2013-06-27 00:58:26 +08:00
|
|
|
/// HasV4TOps, HasV5TOps, HasV5TEOps,
|
2015-03-17 19:55:28 +08:00
|
|
|
/// HasV6Ops, HasV6MOps, HasV6KOps, HasV6T2Ops, HasV7Ops, HasV8Ops -
|
2011-07-07 11:55:05 +08:00
|
|
|
/// Specify whether target support specific ARM ISA variants.
|
2016-06-27 21:06:10 +08:00
|
|
|
bool HasV4TOps = false;
|
|
|
|
bool HasV5TOps = false;
|
|
|
|
bool HasV5TEOps = false;
|
|
|
|
bool HasV6Ops = false;
|
|
|
|
bool HasV6MOps = false;
|
|
|
|
bool HasV6KOps = false;
|
|
|
|
bool HasV6T2Ops = false;
|
|
|
|
bool HasV7Ops = false;
|
|
|
|
bool HasV8Ops = false;
|
|
|
|
bool HasV8_1aOps = false;
|
|
|
|
bool HasV8_2aOps = false;
|
2017-08-10 17:41:00 +08:00
|
|
|
bool HasV8_3aOps = false;
|
2016-06-27 21:06:10 +08:00
|
|
|
bool HasV8MBaselineOps = false;
|
|
|
|
bool HasV8MMainlineOps = false;
|
2011-07-07 11:55:05 +08:00
|
|
|
|
2013-09-13 21:46:57 +08:00
|
|
|
/// HasVFPv2, HasVFPv3, HasVFPv4, HasFPARMv8, HasNEON - Specify what
|
2012-01-22 20:07:33 +08:00
|
|
|
/// floating point ISAs are supported.
|
2016-06-27 21:06:10 +08:00
|
|
|
bool HasVFPv2 = false;
|
|
|
|
bool HasVFPv3 = false;
|
|
|
|
bool HasVFPv4 = false;
|
|
|
|
bool HasFPARMv8 = false;
|
|
|
|
bool HasNEON = false;
|
2007-01-19 15:51:42 +08:00
|
|
|
|
2017-08-11 17:52:30 +08:00
|
|
|
/// HasDotProd - True if the ARMv8.2A dot product instructions are supported.
|
|
|
|
bool HasDotProd = false;
|
|
|
|
|
2009-08-06 00:01:19 +08:00
|
|
|
/// UseNEONForSinglePrecisionFP - if the NEONFP attribute has been
|
|
|
|
/// specified. Use the method useNEONForSinglePrecisionFP() to
|
|
|
|
/// determine if NEON should actually be used.
|
2016-06-27 21:06:10 +08:00
|
|
|
bool UseNEONForSinglePrecisionFP = false;
|
2009-08-05 01:53:06 +08:00
|
|
|
|
2012-09-30 05:43:49 +08:00
|
|
|
/// UseMulOps - True if non-microcoded fused integer multiply-add and
|
|
|
|
/// multiply-subtract instructions should be used.
|
2016-06-27 21:06:10 +08:00
|
|
|
bool UseMulOps = false;
|
2012-09-30 05:43:49 +08:00
|
|
|
|
2010-12-06 06:04:16 +08:00
|
|
|
/// SlowFPVMLx - If the VFP2 / NEON instructions are available, indicates
|
|
|
|
/// whether the FP VML[AS] instructions are slow (if so, don't use them).
|
2016-06-27 21:06:10 +08:00
|
|
|
bool SlowFPVMLx = false;
|
2010-03-25 06:31:46 +08:00
|
|
|
|
2011-04-01 03:38:48 +08:00
|
|
|
/// HasVMLxForwarding - If true, NEON has special multiplier accumulator
|
|
|
|
/// forwarding to allow mul + mla being issued back to back.
|
2016-06-27 21:06:10 +08:00
|
|
|
bool HasVMLxForwarding = false;
|
2011-04-01 03:38:48 +08:00
|
|
|
|
2010-07-14 03:21:50 +08:00
|
|
|
/// SlowFPBrcc - True if floating point compare + branch is slow.
|
2016-06-27 21:06:10 +08:00
|
|
|
bool SlowFPBrcc = false;
|
2010-07-14 03:21:50 +08:00
|
|
|
|
2011-07-08 03:09:06 +08:00
|
|
|
/// InThumbMode - True if compiling for Thumb, false for ARM.
|
2016-06-27 21:06:10 +08:00
|
|
|
bool InThumbMode = false;
|
2009-06-02 04:00:48 +08:00
|
|
|
|
2015-05-12 09:26:05 +08:00
|
|
|
/// UseSoftFloat - True if we're using software floating point features.
|
2016-06-27 21:06:10 +08:00
|
|
|
bool UseSoftFloat = false;
|
2015-05-12 09:26:05 +08:00
|
|
|
|
2017-07-28 03:56:44 +08:00
|
|
|
/// UseMISched - True if MachineScheduler should be used for this subtarget.
|
|
|
|
bool UseMISched = false;
|
|
|
|
|
2017-08-18 22:27:51 +08:00
|
|
|
/// UsePostRAScheduler - True if scheduling should happen again after
|
|
|
|
/// register allocation.
|
|
|
|
bool UsePostRAScheduler = false;
|
|
|
|
|
2011-07-07 08:08:19 +08:00
|
|
|
/// HasThumb2 - True if Thumb2 instructions are supported.
|
2016-06-27 21:06:10 +08:00
|
|
|
bool HasThumb2 = false;
|
2007-01-19 15:51:42 +08:00
|
|
|
|
2010-08-11 15:17:46 +08:00
|
|
|
/// NoARM - True if subtarget does not support ARM mode execution.
|
2016-06-27 21:06:10 +08:00
|
|
|
bool NoARM = false;
|
2010-08-11 15:17:46 +08:00
|
|
|
|
2015-07-21 09:42:02 +08:00
|
|
|
/// ReserveR9 - True if R9 is not available as a general purpose register.
|
2016-06-27 21:06:10 +08:00
|
|
|
bool ReserveR9 = false;
|
2007-02-14 03:52:28 +08:00
|
|
|
|
2015-07-16 08:58:23 +08:00
|
|
|
/// NoMovt - True if MOVT / MOVW pairs are not used for materialization of
|
|
|
|
/// 32-bit imms (including global addresses).
|
2016-06-27 21:06:10 +08:00
|
|
|
bool NoMovt = false;
|
2009-11-24 08:44:37 +08:00
|
|
|
|
2011-10-08 01:17:49 +08:00
|
|
|
/// SupportsTailCall - True if the OS supports tail call. The dynamic linker
|
|
|
|
/// must be able to synthesize call stubs for interworking between ARM and
|
|
|
|
/// Thumb.
|
2016-06-27 21:06:10 +08:00
|
|
|
bool SupportsTailCall = false;
|
2011-10-08 01:17:49 +08:00
|
|
|
|
2015-12-01 18:23:06 +08:00
|
|
|
/// HasFP16 - True if subtarget supports half-precision FP conversions
|
2016-06-27 21:06:10 +08:00
|
|
|
bool HasFP16 = false;
|
2010-03-15 02:42:38 +08:00
|
|
|
|
2015-12-01 18:23:06 +08:00
|
|
|
/// HasFullFP16 - True if subtarget supports half-precision FP operations
|
2016-06-27 21:06:10 +08:00
|
|
|
bool HasFullFP16 = false;
|
2015-12-01 18:23:06 +08:00
|
|
|
|
2010-10-13 00:22:47 +08:00
|
|
|
/// HasD16 - True if subtarget is limited to 16 double precision
|
|
|
|
/// FP registers for VFPv3.
|
2016-06-27 21:06:10 +08:00
|
|
|
bool HasD16 = false;
|
2010-10-13 00:22:47 +08:00
|
|
|
|
2017-04-20 17:38:25 +08:00
|
|
|
/// HasHardwareDivide - True if subtarget supports [su]div in Thumb mode
|
|
|
|
bool HasHardwareDivideInThumb = false;
|
2010-05-06 07:44:43 +08:00
|
|
|
|
2012-09-30 05:43:49 +08:00
|
|
|
/// HasHardwareDivideInARM - True if subtarget supports [su]div in ARM mode
|
2016-06-27 21:06:10 +08:00
|
|
|
bool HasHardwareDivideInARM = false;
|
2012-09-30 05:43:49 +08:00
|
|
|
|
2010-08-11 14:22:01 +08:00
|
|
|
/// HasDataBarrier - True if the subtarget supports DMB / DSB data barrier
|
|
|
|
/// instructions.
|
2016-06-27 21:06:10 +08:00
|
|
|
bool HasDataBarrier = false;
|
2010-08-11 14:22:01 +08:00
|
|
|
|
2016-01-15 18:23:46 +08:00
|
|
|
/// HasV7Clrex - True if the subtarget supports CLREX instructions
|
2016-06-27 21:06:10 +08:00
|
|
|
bool HasV7Clrex = false;
|
2016-01-15 18:23:46 +08:00
|
|
|
|
|
|
|
/// HasAcquireRelease - True if the subtarget supports v8 atomics (LDA/LDAEX etc)
|
|
|
|
/// instructions
|
2016-06-27 21:06:10 +08:00
|
|
|
bool HasAcquireRelease = false;
|
2016-01-15 18:23:46 +08:00
|
|
|
|
2010-08-10 02:35:19 +08:00
|
|
|
/// Pref32BitThumb - If true, codegen would prefer 32-bit Thumb instructions
|
|
|
|
/// over 16-bit ones.
|
2016-06-27 21:06:10 +08:00
|
|
|
bool Pref32BitThumb = false;
|
2010-08-10 02:35:19 +08:00
|
|
|
|
2011-04-20 02:11:49 +08:00
|
|
|
/// AvoidCPSRPartialUpdate - If true, codegen would avoid using instructions
|
|
|
|
/// that partially update CPSR and add false dependency on the previous
|
|
|
|
/// CPSR setting instruction.
|
2016-06-27 21:06:10 +08:00
|
|
|
bool AvoidCPSRPartialUpdate = false;
|
2011-04-20 02:11:49 +08:00
|
|
|
|
2017-06-02 16:53:19 +08:00
|
|
|
/// CheapPredicableCPSRDef - If true, disable +1 predication cost
|
|
|
|
/// for instructions updating CPSR. Enabled for Cortex-A57.
|
|
|
|
bool CheapPredicableCPSRDef = false;
|
|
|
|
|
2012-12-21 03:59:30 +08:00
|
|
|
/// AvoidMOVsShifterOperand - If true, codegen should avoid using flag setting
|
|
|
|
/// movs with shifter operand (i.e. asr, lsl, lsr).
|
2016-06-27 21:06:10 +08:00
|
|
|
bool AvoidMOVsShifterOperand = false;
|
2012-12-21 03:59:30 +08:00
|
|
|
|
2016-06-03 22:03:27 +08:00
|
|
|
/// HasRetAddrStack - Some processors perform return stack prediction. CodeGen should
|
2012-02-29 02:51:51 +08:00
|
|
|
/// avoid issue "normal" call instructions to callees which do not return.
|
2016-06-27 21:06:10 +08:00
|
|
|
bool HasRetAddrStack = false;
|
2012-02-29 02:51:51 +08:00
|
|
|
|
2017-06-28 22:11:15 +08:00
|
|
|
/// HasBranchPredictor - True if the subtarget has a branch predictor. Having
|
|
|
|
/// a branch predictor or not changes the expected cost of taking a branch
|
|
|
|
/// which affects the choice of whether to use predicated instructions.
|
|
|
|
bool HasBranchPredictor = true;
|
|
|
|
|
2010-11-03 14:34:55 +08:00
|
|
|
/// HasMPExtension - True if the subtarget supports Multiprocessing
|
|
|
|
/// extension (ARMv7 only).
|
2016-06-27 21:06:10 +08:00
|
|
|
bool HasMPExtension = false;
|
2010-11-03 14:34:55 +08:00
|
|
|
|
2013-11-01 21:27:35 +08:00
|
|
|
/// HasVirtualization - True if the subtarget supports the Virtualization
|
|
|
|
/// extension.
|
2016-06-27 21:06:10 +08:00
|
|
|
bool HasVirtualization = false;
|
2013-11-01 21:27:35 +08:00
|
|
|
|
2010-08-11 23:44:15 +08:00
|
|
|
/// FPOnlySP - If true, the floating point unit only supports single
|
|
|
|
/// precision.
|
2016-06-27 21:06:10 +08:00
|
|
|
bool FPOnlySP = false;
|
2010-08-11 23:44:15 +08:00
|
|
|
|
2013-05-24 03:11:14 +08:00
|
|
|
/// If true, the processor supports the Performance Monitor Extensions. These
|
|
|
|
/// include a generic cycle-counter as well as more fine-grained (often
|
|
|
|
/// implementation-specific) events.
|
2016-06-27 21:06:10 +08:00
|
|
|
bool HasPerfMon = false;
|
2013-05-24 03:11:14 +08:00
|
|
|
|
2013-04-10 20:08:35 +08:00
|
|
|
/// HasTrustZone - if true, processor supports TrustZone security extensions
|
2016-06-27 21:06:10 +08:00
|
|
|
bool HasTrustZone = false;
|
2013-04-10 20:08:35 +08:00
|
|
|
|
2016-01-25 19:24:47 +08:00
|
|
|
/// Has8MSecExt - if true, processor supports ARMv8-M Security Extensions
|
2016-06-27 21:06:10 +08:00
|
|
|
bool Has8MSecExt = false;
|
2016-01-25 19:24:47 +08:00
|
|
|
|
2013-09-19 19:59:01 +08:00
|
|
|
/// HasCrypto - if true, processor supports Cryptography extensions
|
2016-06-27 21:06:10 +08:00
|
|
|
bool HasCrypto = false;
|
2013-09-19 19:59:01 +08:00
|
|
|
|
2013-10-29 17:47:35 +08:00
|
|
|
/// HasCRC - if true, processor supports CRC instructions
|
2016-06-27 21:06:10 +08:00
|
|
|
bool HasCRC = false;
|
2013-10-29 17:47:35 +08:00
|
|
|
|
2016-06-03 22:03:27 +08:00
|
|
|
/// HasRAS - if true, the processor supports RAS extensions
|
2016-06-27 21:06:10 +08:00
|
|
|
bool HasRAS = false;
|
2016-06-03 22:03:27 +08:00
|
|
|
|
2014-04-01 21:22:02 +08:00
|
|
|
/// If true, the instructions "vmov.i32 d0, #0" and "vmov.i32 q0, #0" are
|
|
|
|
/// particularly effective at zeroing a VFP register.
|
2016-06-27 21:06:10 +08:00
|
|
|
bool HasZeroCycleZeroing = false;
|
2014-04-01 21:22:02 +08:00
|
|
|
|
2016-10-13 22:57:43 +08:00
|
|
|
/// HasFPAO - if true, processor does positive address offset computation faster
|
|
|
|
bool HasFPAO = false;
|
|
|
|
|
2017-06-22 17:39:36 +08:00
|
|
|
/// HasFuseAES - if true, processor executes back to back AES instruction
|
|
|
|
/// pairs faster.
|
|
|
|
bool HasFuseAES = false;
|
|
|
|
|
2016-06-23 15:47:35 +08:00
|
|
|
/// If true, if conversion may decide to leave some instructions unpredicated.
|
2016-06-27 21:06:10 +08:00
|
|
|
bool IsProfitableToUnpredicate = false;
|
2016-06-23 15:47:35 +08:00
|
|
|
|
|
|
|
/// If true, VMOV will be favored over VGETLNi32.
|
2016-06-27 21:06:10 +08:00
|
|
|
bool HasSlowVGETLNi32 = false;
|
2016-06-23 15:47:35 +08:00
|
|
|
|
|
|
|
/// If true, VMOV will be favored over VDUP.
|
2016-06-27 21:06:10 +08:00
|
|
|
bool HasSlowVDUP32 = false;
|
2016-06-23 15:47:35 +08:00
|
|
|
|
|
|
|
/// If true, VMOVSR will be favored over VMOVDRR.
|
2016-06-27 21:06:10 +08:00
|
|
|
bool PreferVMOVSR = false;
|
2016-06-23 15:47:35 +08:00
|
|
|
|
|
|
|
/// If true, ISHST barriers will be used for Release semantics.
|
2016-06-27 21:06:10 +08:00
|
|
|
bool PreferISHST = false;
|
2016-06-23 15:47:35 +08:00
|
|
|
|
2016-07-06 17:22:23 +08:00
|
|
|
/// If true, a VLDM/VSTM starting with an odd register number is considered to
|
|
|
|
/// take more microops than single VLDRS/VSTRS.
|
|
|
|
bool SlowOddRegister = false;
|
|
|
|
|
|
|
|
/// If true, loading into a D subregister will be penalized.
|
|
|
|
bool SlowLoadDSubregister = false;
|
|
|
|
|
|
|
|
/// If true, the AGU and NEON/FPU units are multiplexed.
|
|
|
|
bool HasMuxedUnits = false;
|
|
|
|
|
2016-07-06 19:22:11 +08:00
|
|
|
/// If true, VMOVS will never be widened to VMOVD
|
|
|
|
bool DontWidenVMOVS = false;
|
|
|
|
|
2016-07-07 17:11:39 +08:00
|
|
|
/// If true, run the MLx expansion pass.
|
|
|
|
bool ExpandMLx = false;
|
|
|
|
|
|
|
|
/// If true, VFP/NEON VMLA/VMLS have special RAW hazards.
|
|
|
|
bool HasVMLxHazards = false;
|
|
|
|
|
2017-07-28 20:54:57 +08:00
|
|
|
// If true, read thread pointer from coprocessor register.
|
|
|
|
bool ReadTPHard = false;
|
|
|
|
|
2016-06-23 15:47:35 +08:00
|
|
|
/// If true, VMOVRS, VMOVSR and VMOVS will be converted from VFP to NEON.
|
2016-06-27 21:06:10 +08:00
|
|
|
bool UseNEONForFPMovs = false;
|
2016-06-23 15:47:35 +08:00
|
|
|
|
2016-06-27 17:08:23 +08:00
|
|
|
/// If true, VLDn instructions take an extra cycle for unaligned accesses.
|
2016-06-27 21:06:10 +08:00
|
|
|
bool CheckVLDnAlign = false;
|
2016-06-27 17:08:23 +08:00
|
|
|
|
|
|
|
/// If true, VFP instructions are not pipelined.
|
2016-06-27 21:06:10 +08:00
|
|
|
bool NonpipelinedVFP = false;
|
2016-06-27 17:08:23 +08:00
|
|
|
|
2015-07-29 06:44:28 +08:00
|
|
|
/// StrictAlign - If true, the subtarget disallows unaligned memory
|
2010-09-28 12:09:35 +08:00
|
|
|
/// accesses for some types. For details, see
|
2014-07-28 01:46:40 +08:00
|
|
|
/// ARMTargetLowering::allowsMisalignedMemoryAccesses().
|
2016-06-27 21:06:10 +08:00
|
|
|
bool StrictAlign = false;
|
2010-09-28 12:09:35 +08:00
|
|
|
|
2013-11-14 02:29:49 +08:00
|
|
|
/// RestrictIT - If true, the subtarget disallows generation of deprecated IT
|
|
|
|
/// blocks to conform to ARMv8 rule.
|
2016-06-27 21:06:10 +08:00
|
|
|
bool RestrictIT = false;
|
2013-11-14 02:29:49 +08:00
|
|
|
|
2015-09-25 01:31:16 +08:00
|
|
|
/// HasDSP - If true, the subtarget supports the DSP (saturating arith
|
|
|
|
/// and such) instructions.
|
2016-06-27 21:06:10 +08:00
|
|
|
bool HasDSP = false;
|
2011-07-02 05:12:19 +08:00
|
|
|
|
2013-01-31 00:30:19 +08:00
|
|
|
/// NaCl TRAP instruction is generated instead of the regular TRAP.
|
2016-06-27 21:06:10 +08:00
|
|
|
bool UseNaClTrap = false;
|
2013-01-31 00:30:19 +08:00
|
|
|
|
2015-07-07 14:54:42 +08:00
|
|
|
/// Generate calls via indirect call instructions.
|
2016-06-27 21:06:10 +08:00
|
|
|
bool GenLongCalls = false;
|
2015-07-07 14:54:42 +08:00
|
|
|
|
2016-12-15 15:59:08 +08:00
|
|
|
/// Generate code that does not contain data access to code sections.
|
|
|
|
bool GenExecuteOnly = false;
|
|
|
|
|
2013-03-22 02:47:47 +08:00
|
|
|
/// Target machine allowed unsafe FP math (such as use of NEON fp)
|
2016-06-27 21:06:10 +08:00
|
|
|
bool UnsafeFPMath = false;
|
2013-03-22 02:47:47 +08:00
|
|
|
|
2015-10-29 06:56:36 +08:00
|
|
|
/// UseSjLjEH - If true, the target uses SjLj exception handling (e.g. iOS).
|
2016-06-27 21:06:10 +08:00
|
|
|
bool UseSjLjEH = false;
|
2015-10-29 06:56:36 +08:00
|
|
|
|
[ARM] [Assembler] Support negative immediates for A32, T32 and T16
Summary:
To support negative immediates for certain arithmetic instructions, the
instruction is converted to the inverse instruction with a negated (or inverted)
immediate. For example, "ADD r0, r1, #FFFFFFFF" cannot be encoded as an ADD
instruction. However, "SUB r0, r1, #1" is equivalent.
These conversions are different from instruction aliases. An alias maps
several assembler instructions onto one encoding. A conversion, however, maps
an *invalid* instruction--e.g. with an immediate that cannot be represented in
the encoding--to a different (but equivalent) instruction.
Several instructions with negative immediates were being converted already, but
this was not systematically tested, nor did it cover all instructions.
This patch implements all possible substitutions for ARM, Thumb1 and
Thumb2 assembler and adds tests. It also adds a feature flag
(-mattr=+no-neg-immediates) to turn these substitutions off. This is
helpful for users who want their code to assemble to exactly what they
wrote.
Reviewers: t.p.northover, rovka, samparker, javed.absar, peter.smith, rengolin
Reviewed By: javed.absar
Subscribers: aadg, aemerson, llvm-commits
Differential Revision: https://reviews.llvm.org/D30571
llvm-svn: 298380
2017-03-21 22:59:17 +08:00
|
|
|
/// Implicitly convert an instruction to a different one if its immediates
|
|
|
|
/// cannot be encoded. For example, ADD r0, r1, #FFFFFFFF -> SUB r0, r1, #1.
|
|
|
|
bool NegativeImmediates = true;
|
|
|
|
|
2007-01-19 15:51:42 +08:00
|
|
|
/// stackAlignment - The minimum alignment known to hold of the stack frame on
|
|
|
|
/// entry to the function and which must be maintained by every function.
|
2016-06-27 21:06:10 +08:00
|
|
|
unsigned stackAlignment = 4;
|
2007-01-19 15:51:42 +08:00
|
|
|
|
2009-05-24 03:50:50 +08:00
|
|
|
/// CPUString - String name of used CPU.
|
|
|
|
std::string CPUString;
|
|
|
|
|
2016-06-27 21:06:10 +08:00
|
|
|
unsigned MaxInterleaveFactor = 1;
|
2016-06-27 17:08:23 +08:00
|
|
|
|
2016-07-06 19:22:11 +08:00
|
|
|
/// Clearance before partial register updates (in number of instructions)
|
|
|
|
unsigned PartialUpdateClearance = 0;
|
|
|
|
|
2016-06-27 17:08:23 +08:00
|
|
|
/// What kind of timing do load multiple/store multiple have (double issue,
|
|
|
|
/// single issue etc).
|
2016-06-27 21:06:10 +08:00
|
|
|
ARMLdStMultipleTiming LdStMultipleTiming = SingleIssue;
|
2016-06-27 17:08:23 +08:00
|
|
|
|
|
|
|
/// The adjustment that we need to apply to get the operand latency from the
|
|
|
|
/// operand cycle returned by the itinerary data for pre-ISel operands.
|
2016-06-27 21:06:10 +08:00
|
|
|
int PreISelOperandLatencyAdjustment = 2;
|
2016-06-27 17:08:23 +08:00
|
|
|
|
2014-03-28 22:35:30 +08:00
|
|
|
/// IsLittle - The target is Little Endian
|
|
|
|
bool IsLittle;
|
|
|
|
|
2011-01-12 05:46:47 +08:00
|
|
|
/// TargetTriple - What processor and OS we're targeting.
|
|
|
|
Triple TargetTriple;
|
|
|
|
|
2012-08-08 10:44:16 +08:00
|
|
|
/// SchedModel - Processor specific instruction costs.
|
2014-09-03 01:43:54 +08:00
|
|
|
MCSchedModel SchedModel;
|
2012-08-08 10:44:16 +08:00
|
|
|
|
2009-06-19 09:51:50 +08:00
|
|
|
/// Selected instruction itineraries (one entry per itinerary class.)
|
|
|
|
InstrItineraryData InstrItins;
|
2009-08-11 23:33:49 +08:00
|
|
|
|
2013-03-22 02:47:47 +08:00
|
|
|
/// Options passed via command line that could influence the target
|
|
|
|
const TargetOptions &Options;
|
|
|
|
|
2014-12-18 10:20:58 +08:00
|
|
|
const ARMBaseTargetMachine &TM;
|
2007-02-14 03:52:28 +08:00
|
|
|
|
2014-12-18 10:20:58 +08:00
|
|
|
public:
|
2007-01-19 15:51:42 +08:00
|
|
|
/// This constructor initializes the data members to match that
|
2009-08-03 06:11:08 +08:00
|
|
|
/// of the specified triple.
|
2007-01-19 15:51:42 +08:00
|
|
|
///
|
2015-06-10 20:11:26 +08:00
|
|
|
ARMSubtarget(const Triple &TT, const std::string &CPU, const std::string &FS,
|
|
|
|
const ARMBaseTargetMachine &TM, bool IsLittle);
|
2007-01-19 15:51:42 +08:00
|
|
|
|
Drop ISD::MEMSET, ISD::MEMMOVE, and ISD::MEMCPY, which are not Legal
on any current target and aren't optimized in DAGCombiner. Instead
of using intermediate nodes, expand the operations, choosing between
simple loads/stores, target-specific code, and library calls,
immediately.
Previously, the code to emit optimized code for these operations
was only used at initial SelectionDAG construction time; now it is
used at all times. This fixes some cases where rep;movs was being
used for small copies where simple loads/stores would be better.
This also cleans up code that checks for alignments less than 4;
let the targets make that decision instead of doing it in
target-independent code. This allows x86 to use rep;movs in
low-alignment cases.
Also, this fixes a bug that resulted in the use of rep;stos for
memsets of 0 with non-constant memory size when the alignment was
at least 4. It's better to use the library in this case, which
can be significantly faster when the size is large.
This also preserves more SourceValue information when memory
intrinsics are lowered into simple loads/stores.
llvm-svn: 49572
2008-04-12 12:36:06 +08:00
|
|
|
/// getMaxInlineSizeThreshold - Returns the maximum memset / memcpy size
|
|
|
|
/// that still makes it profitable to inline the call.
|
2007-10-31 22:39:58 +08:00
|
|
|
unsigned getMaxInlineSizeThreshold() const {
|
2014-05-16 22:24:22 +08:00
|
|
|
return 64;
|
2007-10-31 22:39:58 +08:00
|
|
|
}
|
2017-01-28 07:58:02 +08:00
|
|
|
|
2009-05-24 03:51:43 +08:00
|
|
|
/// ParseSubtargetFeatures - Parses features string setting specified
|
2007-01-19 15:51:42 +08:00
|
|
|
/// subtarget options. Definition of function is auto generated by tblgen.
|
2011-07-07 15:07:08 +08:00
|
|
|
void ParseSubtargetFeatures(StringRef CPU, StringRef FS);
|
2007-01-19 15:51:42 +08:00
|
|
|
|
2014-06-13 08:20:35 +08:00
|
|
|
/// initializeSubtargetDependencies - Initializes using a CPU and feature string
|
|
|
|
/// so that we can use initializer lists for subtarget initialization.
|
|
|
|
ARMSubtarget &initializeSubtargetDependencies(StringRef CPU, StringRef FS);
|
|
|
|
|
2014-08-05 05:25:23 +08:00
|
|
|
const ARMSelectionDAGInfo *getSelectionDAGInfo() const override {
|
|
|
|
return &TSInfo;
|
|
|
|
}
|
2017-01-28 07:58:02 +08:00
|
|
|
|
2014-08-05 05:25:23 +08:00
|
|
|
const ARMBaseInstrInfo *getInstrInfo() const override {
|
|
|
|
return InstrInfo.get();
|
|
|
|
}
|
2017-01-28 07:58:02 +08:00
|
|
|
|
2014-08-05 05:25:23 +08:00
|
|
|
const ARMTargetLowering *getTargetLowering() const override {
|
|
|
|
return &TLInfo;
|
|
|
|
}
|
2017-01-28 07:58:02 +08:00
|
|
|
|
2014-08-05 05:25:23 +08:00
|
|
|
const ARMFrameLowering *getFrameLowering() const override {
|
|
|
|
return FrameLowering.get();
|
|
|
|
}
|
2017-01-28 07:58:02 +08:00
|
|
|
|
2014-08-05 05:25:23 +08:00
|
|
|
const ARMBaseRegisterInfo *getRegisterInfo() const override {
|
2014-06-27 03:30:02 +08:00
|
|
|
return &InstrInfo->getRegisterInfo();
|
|
|
|
}
|
2014-06-13 08:20:35 +08:00
|
|
|
|
2016-11-11 16:27:37 +08:00
|
|
|
const CallLowering *getCallLowering() const override;
|
|
|
|
const InstructionSelector *getInstructionSelector() const override;
|
|
|
|
const LegalizerInfo *getLegalizerInfo() const override;
|
|
|
|
const RegisterBankInfo *getRegBankInfo() const override;
|
|
|
|
|
2013-02-16 09:36:26 +08:00
|
|
|
private:
|
2014-06-13 08:20:39 +08:00
|
|
|
ARMSelectionDAGInfo TSInfo;
|
2015-01-27 03:03:15 +08:00
|
|
|
// Either Thumb1FrameLowering or ARMFrameLowering.
|
|
|
|
std::unique_ptr<ARMFrameLowering> FrameLowering;
|
2014-06-27 03:30:02 +08:00
|
|
|
// Either Thumb1InstrInfo or Thumb2InstrInfo.
|
|
|
|
std::unique_ptr<ARMBaseInstrInfo> InstrInfo;
|
|
|
|
ARMTargetLowering TLInfo;
|
2014-06-13 08:20:35 +08:00
|
|
|
|
2017-08-16 06:31:51 +08:00
|
|
|
/// GlobalISel related APIs.
|
|
|
|
std::unique_ptr<CallLowering> CallLoweringInfo;
|
|
|
|
std::unique_ptr<InstructionSelector> InstSelector;
|
|
|
|
std::unique_ptr<LegalizerInfo> Legalizer;
|
|
|
|
std::unique_ptr<RegisterBankInfo> RegBankInfo;
|
2016-11-11 16:27:37 +08:00
|
|
|
|
2013-02-16 09:36:26 +08:00
|
|
|
void initializeEnvironment();
|
2014-09-04 04:36:31 +08:00
|
|
|
void initSubtargetFeatures(StringRef CPU, StringRef FS);
|
2015-01-27 03:03:15 +08:00
|
|
|
ARMFrameLowering *initializeFrameLowering(StringRef CPU, StringRef FS);
|
|
|
|
|
2013-02-16 09:36:26 +08:00
|
|
|
public:
|
Various bits of framework needed for precise machine-level selection
DAG scheduling during isel. Most new functionality is currently
guarded by -enable-sched-cycles and -enable-sched-hazard.
Added InstrItineraryData::IssueWidth field, currently derived from
ARM itineraries, but could be initialized differently on other targets.
Added ScheduleHazardRecognizer::MaxLookAhead to indicate whether it is
active, and if so how many cycles of state it holds.
Added SchedulingPriorityQueue::HasReadyFilter to allowing gating entry
into the scheduler's available queue.
ScoreboardHazardRecognizer now accesses the ScheduleDAG in order to
get information about it's SUnits, provides RecedeCycle for bottom-up
scheduling, correctly computes scoreboard depth, tracks IssueCount, and
considers potential stall cycles when checking for hazards.
ScheduleDAGRRList now models machine cycles and hazards (under
flags). It tracks MinAvailableCycle, drives the hazard recognizer and
priority queue's ready filter, manages a new PendingQueue, properly
accounts for stall cycles, etc.
llvm-svn: 122541
2010-12-24 13:03:26 +08:00
|
|
|
void computeIssueWidth();
|
|
|
|
|
2011-07-07 11:55:05 +08:00
|
|
|
bool hasV4TOps() const { return HasV4TOps; }
|
|
|
|
bool hasV5TOps() const { return HasV5TOps; }
|
|
|
|
bool hasV5TEOps() const { return HasV5TEOps; }
|
|
|
|
bool hasV6Ops() const { return HasV6Ops; }
|
2013-10-08 00:55:23 +08:00
|
|
|
bool hasV6MOps() const { return HasV6MOps; }
|
2015-03-17 19:55:28 +08:00
|
|
|
bool hasV6KOps() const { return HasV6KOps; }
|
2011-07-07 11:55:05 +08:00
|
|
|
bool hasV6T2Ops() const { return HasV6T2Ops; }
|
|
|
|
bool hasV7Ops() const { return HasV7Ops; }
|
2013-06-27 00:58:26 +08:00
|
|
|
bool hasV8Ops() const { return HasV8Ops; }
|
2015-04-01 22:54:56 +08:00
|
|
|
bool hasV8_1aOps() const { return HasV8_1aOps; }
|
2015-12-01 18:23:06 +08:00
|
|
|
bool hasV8_2aOps() const { return HasV8_2aOps; }
|
2017-08-10 17:41:00 +08:00
|
|
|
bool hasV8_3aOps() const { return HasV8_3aOps; }
|
2016-01-15 18:24:39 +08:00
|
|
|
bool hasV8MBaselineOps() const { return HasV8MBaselineOps; }
|
|
|
|
bool hasV8MMainlineOps() const { return HasV8MMainlineOps; }
|
2007-01-19 15:51:42 +08:00
|
|
|
|
2016-07-06 17:22:23 +08:00
|
|
|
/// @{
|
|
|
|
/// These functions are obsolete, please consider adding subtarget features
|
|
|
|
/// or properties instead of calling them.
|
2012-11-30 03:48:01 +08:00
|
|
|
bool isCortexA5() const { return ARMProcFamily == CortexA5; }
|
2014-04-01 22:10:07 +08:00
|
|
|
bool isCortexA7() const { return ARMProcFamily == CortexA7; }
|
2010-09-10 09:29:16 +08:00
|
|
|
bool isCortexA8() const { return ARMProcFamily == CortexA8; }
|
|
|
|
bool isCortexA9() const { return ARMProcFamily == CortexA9; }
|
2012-09-13 23:05:10 +08:00
|
|
|
bool isCortexA15() const { return ARMProcFamily == CortexA15; }
|
2012-09-30 05:43:49 +08:00
|
|
|
bool isSwift() const { return ARMProcFamily == Swift; }
|
2016-03-24 00:18:13 +08:00
|
|
|
bool isCortexM3() const { return ARMProcFamily == CortexM3; }
|
2013-12-07 06:48:17 +08:00
|
|
|
bool isLikeA9() const { return isCortexA9() || isCortexA15() || isKrait(); }
|
2012-12-21 12:35:05 +08:00
|
|
|
bool isCortexR5() const { return ARMProcFamily == CortexR5; }
|
2013-12-07 06:48:17 +08:00
|
|
|
bool isKrait() const { return ARMProcFamily == Krait; }
|
2016-07-06 17:22:23 +08:00
|
|
|
/// @}
|
2010-09-10 09:29:16 +08:00
|
|
|
|
2010-08-11 15:17:46 +08:00
|
|
|
bool hasARMOps() const { return !NoARM; }
|
|
|
|
|
2011-07-07 11:55:05 +08:00
|
|
|
bool hasVFP2() const { return HasVFPv2; }
|
|
|
|
bool hasVFP3() const { return HasVFPv3; }
|
2012-01-22 20:07:33 +08:00
|
|
|
bool hasVFP4() const { return HasVFPv4; }
|
2013-09-13 21:46:57 +08:00
|
|
|
bool hasFPARMv8() const { return HasFPARMv8; }
|
2011-07-07 11:55:05 +08:00
|
|
|
bool hasNEON() const { return HasNEON; }
|
2013-09-19 19:59:01 +08:00
|
|
|
bool hasCrypto() const { return HasCrypto; }
|
2017-08-11 17:52:30 +08:00
|
|
|
bool hasDotProd() const { return HasDotProd; }
|
2013-10-29 17:47:35 +08:00
|
|
|
bool hasCRC() const { return HasCRC; }
|
2016-06-03 22:03:27 +08:00
|
|
|
bool hasRAS() const { return HasRAS; }
|
2013-11-01 21:27:35 +08:00
|
|
|
bool hasVirtualization() const { return HasVirtualization; }
|
2017-01-28 07:58:02 +08:00
|
|
|
|
2009-08-11 23:33:49 +08:00
|
|
|
bool useNEONForSinglePrecisionFP() const {
|
2015-02-05 10:09:33 +08:00
|
|
|
return hasNEON() && UseNEONForSinglePrecisionFP;
|
|
|
|
}
|
2011-07-07 11:55:05 +08:00
|
|
|
|
2017-04-20 17:38:25 +08:00
|
|
|
bool hasDivideInThumbMode() const { return HasHardwareDivideInThumb; }
|
2012-09-30 05:43:49 +08:00
|
|
|
bool hasDivideInARMMode() const { return HasHardwareDivideInARM; }
|
2010-08-11 14:22:01 +08:00
|
|
|
bool hasDataBarrier() const { return HasDataBarrier; }
|
2016-01-15 18:23:46 +08:00
|
|
|
bool hasV7Clrex() const { return HasV7Clrex; }
|
|
|
|
bool hasAcquireRelease() const { return HasAcquireRelease; }
|
2017-01-28 07:58:02 +08:00
|
|
|
|
2013-10-25 17:30:24 +08:00
|
|
|
bool hasAnyDataBarrier() const {
|
|
|
|
return HasDataBarrier || (hasV6Ops() && !isThumb());
|
|
|
|
}
|
2017-01-28 07:58:02 +08:00
|
|
|
|
2012-09-30 05:43:49 +08:00
|
|
|
bool useMulOps() const { return UseMulOps; }
|
2010-12-06 06:04:16 +08:00
|
|
|
bool useFPVMLx() const { return !SlowFPVMLx; }
|
2011-04-01 03:38:48 +08:00
|
|
|
bool hasVMLxForwarding() const { return HasVMLxForwarding; }
|
2010-07-14 03:21:50 +08:00
|
|
|
bool isFPBrccSlow() const { return SlowFPBrcc; }
|
2010-08-11 23:44:15 +08:00
|
|
|
bool isFPOnlySP() const { return FPOnlySP; }
|
2013-05-24 03:11:14 +08:00
|
|
|
bool hasPerfMon() const { return HasPerfMon; }
|
2013-04-10 20:08:35 +08:00
|
|
|
bool hasTrustZone() const { return HasTrustZone; }
|
2016-01-25 19:24:47 +08:00
|
|
|
bool has8MSecExt() const { return Has8MSecExt; }
|
2014-04-01 21:22:02 +08:00
|
|
|
bool hasZeroCycleZeroing() const { return HasZeroCycleZeroing; }
|
2016-10-13 22:57:43 +08:00
|
|
|
bool hasFPAO() const { return HasFPAO; }
|
2016-06-23 15:47:35 +08:00
|
|
|
bool isProfitableToUnpredicate() const { return IsProfitableToUnpredicate; }
|
|
|
|
bool hasSlowVGETLNi32() const { return HasSlowVGETLNi32; }
|
|
|
|
bool hasSlowVDUP32() const { return HasSlowVDUP32; }
|
|
|
|
bool preferVMOVSR() const { return PreferVMOVSR; }
|
|
|
|
bool preferISHSTBarriers() const { return PreferISHST; }
|
2016-07-07 17:11:39 +08:00
|
|
|
bool expandMLx() const { return ExpandMLx; }
|
|
|
|
bool hasVMLxHazards() const { return HasVMLxHazards; }
|
2016-07-06 17:22:23 +08:00
|
|
|
bool hasSlowOddRegister() const { return SlowOddRegister; }
|
|
|
|
bool hasSlowLoadDSubregister() const { return SlowLoadDSubregister; }
|
|
|
|
bool hasMuxedUnits() const { return HasMuxedUnits; }
|
2016-07-06 19:22:11 +08:00
|
|
|
bool dontWidenVMOVS() const { return DontWidenVMOVS; }
|
2016-06-23 15:47:35 +08:00
|
|
|
bool useNEONForFPMovs() const { return UseNEONForFPMovs; }
|
2016-06-27 17:08:23 +08:00
|
|
|
bool checkVLDnAccessAlignment() const { return CheckVLDnAlign; }
|
|
|
|
bool nonpipelinedVFP() const { return NonpipelinedVFP; }
|
2010-08-10 02:35:19 +08:00
|
|
|
bool prefers32BitThumb() const { return Pref32BitThumb; }
|
2011-04-20 02:11:49 +08:00
|
|
|
bool avoidCPSRPartialUpdate() const { return AvoidCPSRPartialUpdate; }
|
2017-06-02 16:53:19 +08:00
|
|
|
bool cheapPredicableCPSRDef() const { return CheapPredicableCPSRDef; }
|
2012-12-21 03:59:30 +08:00
|
|
|
bool avoidMOVsShifterOperand() const { return AvoidMOVsShifterOperand; }
|
2016-06-03 22:03:27 +08:00
|
|
|
bool hasRetAddrStack() const { return HasRetAddrStack; }
|
2017-06-28 22:11:15 +08:00
|
|
|
bool hasBranchPredictor() const { return HasBranchPredictor; }
|
2010-11-03 14:34:55 +08:00
|
|
|
bool hasMPExtension() const { return HasMPExtension; }
|
2015-09-25 01:31:16 +08:00
|
|
|
bool hasDSP() const { return HasDSP; }
|
2013-01-31 00:30:19 +08:00
|
|
|
bool useNaClTrap() const { return UseNaClTrap; }
|
2015-10-29 06:56:36 +08:00
|
|
|
bool useSjLjEH() const { return UseSjLjEH; }
|
2015-07-07 14:54:42 +08:00
|
|
|
bool genLongCalls() const { return GenLongCalls; }
|
2016-12-15 15:59:08 +08:00
|
|
|
bool genExecuteOnly() const { return GenExecuteOnly; }
|
2009-08-11 23:33:49 +08:00
|
|
|
|
2010-03-15 02:42:38 +08:00
|
|
|
bool hasFP16() const { return HasFP16; }
|
2010-10-13 00:22:47 +08:00
|
|
|
bool hasD16() const { return HasD16; }
|
2015-12-01 18:23:06 +08:00
|
|
|
bool hasFullFP16() const { return HasFullFP16; }
|
2010-03-15 02:42:38 +08:00
|
|
|
|
2017-06-22 17:39:36 +08:00
|
|
|
bool hasFuseAES() const { return HasFuseAES; }
|
|
|
|
/// \brief Return true if the CPU supports any kind of instruction fusion.
|
|
|
|
bool hasFusion() const { return hasFuseAES(); }
|
|
|
|
|
2011-04-21 06:20:12 +08:00
|
|
|
const Triple &getTargetTriple() const { return TargetTriple; }
|
|
|
|
|
2011-04-20 05:14:45 +08:00
|
|
|
bool isTargetDarwin() const { return TargetTriple.isOSDarwin(); }
|
2014-04-03 04:32:05 +08:00
|
|
|
bool isTargetIOS() const { return TargetTriple.isiOS(); }
|
2015-10-29 06:46:43 +08:00
|
|
|
bool isTargetWatchOS() const { return TargetTriple.isWatchOS(); }
|
2016-01-28 03:32:29 +08:00
|
|
|
bool isTargetWatchABI() const { return TargetTriple.isWatchABI(); }
|
2013-08-30 04:23:14 +08:00
|
|
|
bool isTargetLinux() const { return TargetTriple.isOSLinux(); }
|
2014-04-03 04:32:05 +08:00
|
|
|
bool isTargetNaCl() const { return TargetTriple.isOSNaCl(); }
|
2014-11-23 03:12:10 +08:00
|
|
|
bool isTargetNetBSD() const { return TargetTriple.isOSNetBSD(); }
|
2014-04-03 04:32:05 +08:00
|
|
|
bool isTargetWindows() const { return TargetTriple.isOSWindows(); }
|
2014-01-06 22:28:05 +08:00
|
|
|
|
2014-04-03 04:32:05 +08:00
|
|
|
bool isTargetCOFF() const { return TargetTriple.isOSBinFormatCOFF(); }
|
2013-12-11 00:57:43 +08:00
|
|
|
bool isTargetELF() const { return TargetTriple.isOSBinFormatELF(); }
|
2014-01-06 22:28:05 +08:00
|
|
|
bool isTargetMachO() const { return TargetTriple.isOSBinFormatMachO(); }
|
|
|
|
|
2013-07-16 17:32:17 +08:00
|
|
|
// ARM EABI is the bare-metal EABI described in ARM ABI documents and
|
|
|
|
// can be accessed via -target arm-none-eabi. This is NOT GNUEABI.
|
|
|
|
// FIXME: Add a flag for bare-metal for that target and set Triple::EABI
|
|
|
|
// even for GNUEABI, so we can make a distinction here and still conform to
|
|
|
|
// the EABI on GNU (and Android) mode. This requires change in Clang, too.
|
2014-01-06 20:00:44 +08:00
|
|
|
// FIXME: The Darwin exception is temporary, while we move users to
|
|
|
|
// "*-*-*-macho" triples as quickly as possible.
|
2013-07-16 17:32:17 +08:00
|
|
|
bool isTargetAEABI() const {
|
2014-01-06 20:00:44 +08:00
|
|
|
return (TargetTriple.getEnvironment() == Triple::EABI ||
|
|
|
|
TargetTriple.getEnvironment() == Triple::EABIHF) &&
|
2014-04-03 04:32:05 +08:00
|
|
|
!isTargetDarwin() && !isTargetWindows();
|
2013-12-18 17:27:33 +08:00
|
|
|
}
|
2015-11-09 20:40:30 +08:00
|
|
|
bool isTargetGNUAEABI() const {
|
|
|
|
return (TargetTriple.getEnvironment() == Triple::GNUEABI ||
|
|
|
|
TargetTriple.getEnvironment() == Triple::GNUEABIHF) &&
|
|
|
|
!isTargetDarwin() && !isTargetWindows();
|
|
|
|
}
|
2016-06-25 05:14:33 +08:00
|
|
|
bool isTargetMuslAEABI() const {
|
|
|
|
return (TargetTriple.getEnvironment() == Triple::MuslEABI ||
|
|
|
|
TargetTriple.getEnvironment() == Triple::MuslEABIHF) &&
|
|
|
|
!isTargetDarwin() && !isTargetWindows();
|
|
|
|
}
|
2013-12-18 17:27:33 +08:00
|
|
|
|
2014-01-29 19:50:56 +08:00
|
|
|
// ARM Targets that support EHABI exception handling standard
|
|
|
|
// Darwin uses SjLj. Other targets might need more checks.
|
|
|
|
bool isTargetEHABICompatible() const {
|
|
|
|
return (TargetTriple.getEnvironment() == Triple::EABI ||
|
|
|
|
TargetTriple.getEnvironment() == Triple::GNUEABI ||
|
2016-06-25 05:14:33 +08:00
|
|
|
TargetTriple.getEnvironment() == Triple::MuslEABI ||
|
2014-01-29 19:50:56 +08:00
|
|
|
TargetTriple.getEnvironment() == Triple::EABIHF ||
|
2014-01-30 22:18:25 +08:00
|
|
|
TargetTriple.getEnvironment() == Triple::GNUEABIHF ||
|
2016-06-25 05:14:33 +08:00
|
|
|
TargetTriple.getEnvironment() == Triple::MuslEABIHF ||
|
2015-10-09 05:21:24 +08:00
|
|
|
isTargetAndroid()) &&
|
2014-04-03 04:32:05 +08:00
|
|
|
!isTargetDarwin() && !isTargetWindows();
|
2014-01-29 19:50:56 +08:00
|
|
|
}
|
|
|
|
|
2013-12-18 17:27:33 +08:00
|
|
|
bool isTargetHardFloat() const {
|
2014-04-03 04:32:05 +08:00
|
|
|
// FIXME: this is invalid for WindowsCE
|
2013-12-18 17:27:33 +08:00
|
|
|
return TargetTriple.getEnvironment() == Triple::GNUEABIHF ||
|
2016-06-25 05:14:33 +08:00
|
|
|
TargetTriple.getEnvironment() == Triple::MuslEABIHF ||
|
2014-04-03 04:32:05 +08:00
|
|
|
TargetTriple.getEnvironment() == Triple::EABIHF ||
|
2015-10-29 06:46:43 +08:00
|
|
|
isTargetWindows() || isAAPCS16_ABI();
|
2013-07-16 17:32:17 +08:00
|
|
|
}
|
2017-01-28 07:58:02 +08:00
|
|
|
|
2015-10-09 05:21:24 +08:00
|
|
|
bool isTargetAndroid() const { return TargetTriple.isAndroid(); }
|
2007-01-20 03:22:40 +08:00
|
|
|
|
2017-01-28 07:58:02 +08:00
|
|
|
bool isXRaySupported() const override;
|
2016-09-19 08:54:35 +08:00
|
|
|
|
2014-12-18 10:20:58 +08:00
|
|
|
bool isAPCS_ABI() const;
|
|
|
|
bool isAAPCS_ABI() const;
|
2015-10-29 06:46:43 +08:00
|
|
|
bool isAAPCS16_ABI() const;
|
2007-02-14 03:52:28 +08:00
|
|
|
|
2016-08-08 23:28:31 +08:00
|
|
|
bool isROPI() const;
|
|
|
|
bool isRWPI() const;
|
|
|
|
|
2017-07-28 03:56:44 +08:00
|
|
|
bool useMachineScheduler() const { return UseMISched; }
|
2017-08-18 22:27:51 +08:00
|
|
|
bool usePostRAScheduler() const { return UsePostRAScheduler; }
|
2015-05-12 09:26:05 +08:00
|
|
|
bool useSoftFloat() const { return UseSoftFloat; }
|
2011-07-08 03:05:12 +08:00
|
|
|
bool isThumb() const { return InThumbMode; }
|
|
|
|
bool isThumb1Only() const { return InThumbMode && !HasThumb2; }
|
|
|
|
bool isThumb2() const { return InThumbMode && HasThumb2; }
|
2011-07-07 08:08:19 +08:00
|
|
|
bool hasThumb2() const { return HasThumb2; }
|
2013-09-23 22:26:15 +08:00
|
|
|
bool isMClass() const { return ARMProcClass == MClass; }
|
|
|
|
bool isRClass() const { return ARMProcClass == RClass; }
|
|
|
|
bool isAClass() const { return ARMProcClass == AClass; }
|
2017-07-28 20:54:57 +08:00
|
|
|
bool isReadTPHard() const { return ReadTPHard; }
|
2007-01-19 15:51:42 +08:00
|
|
|
|
2015-07-21 09:42:02 +08:00
|
|
|
bool isR9Reserved() const {
|
|
|
|
return isTargetMachO() ? (ReserveR9 || !HasV6Ops) : ReserveR9;
|
|
|
|
}
|
2007-01-19 15:51:42 +08:00
|
|
|
|
[ARM] Generate consistent frame records for Thumb2
There is not an official documented ABI for frame pointers in Thumb2,
but we should try to emit something which is useful.
We use r7 as the frame pointer for Thumb code, which currently means
that if a function needs to save a high register (r8-r11), it will get
pushed to the stack between the frame pointer (r7) and link register
(r14). This means that while a stack unwinder can follow the chain of
frame pointers up the stack, it cannot know the offset to lr, so does
not know which functions correspond to the stack frames.
To fix this, we need to push the callee-saved registers in two batches,
with the first push saving the low registers, fp and lr, and the second
push saving the high registers. This is already implemented, but
previously only used for iOS. This patch turns it on for all Thumb2
targets when frame pointers are required by the ABI, and the frame
pointer is r7 (Windows uses r11, so this isn't a problem there). If
frame pointer elimination is enabled we still emit a single push/pop
even if we need a frame pointer for other reasons, to avoid increasing
code size.
We must also ensure that lr is pushed to the stack when using a frame
pointer, so that we end up with a complete frame record. Situations that
could cause this were rare, because we already push lr in most
situations so that we can return using the pop instruction.
Differential Revision: https://reviews.llvm.org/D23516
llvm-svn: 279506
2016-08-23 17:19:22 +08:00
|
|
|
bool useR7AsFramePointer() const {
|
|
|
|
return isTargetDarwin() || (!isTargetWindows() && isThumb());
|
|
|
|
}
|
2017-01-28 07:58:02 +08:00
|
|
|
|
2016-05-14 03:16:14 +08:00
|
|
|
/// Returns true if the frame setup is split into two separate pushes (first
|
|
|
|
/// r0-r7,lr then r8-r11), principally so that the frame pointer is adjacent
|
2016-10-12 05:14:03 +08:00
|
|
|
/// to lr. This is always required on Thumb1-only targets, as the push and
|
|
|
|
/// pop instructions can't access the high registers.
|
[ARM] Generate consistent frame records for Thumb2
There is not an official documented ABI for frame pointers in Thumb2,
but we should try to emit something which is useful.
We use r7 as the frame pointer for Thumb code, which currently means
that if a function needs to save a high register (r8-r11), it will get
pushed to the stack between the frame pointer (r7) and link register
(r14). This means that while a stack unwinder can follow the chain of
frame pointers up the stack, it cannot know the offset to lr, so does
not know which functions correspond to the stack frames.
To fix this, we need to push the callee-saved registers in two batches,
with the first push saving the low registers, fp and lr, and the second
push saving the high registers. This is already implemented, but
previously only used for iOS. This patch turns it on for all Thumb2
targets when frame pointers are required by the ABI, and the frame
pointer is r7 (Windows uses r11, so this isn't a problem there). If
frame pointer elimination is enabled we still emit a single push/pop
even if we need a frame pointer for other reasons, to avoid increasing
code size.
We must also ensure that lr is pushed to the stack when using a frame
pointer, so that we end up with a complete frame record. Situations that
could cause this were rare, because we already push lr in most
situations so that we can return using the pop instruction.
Differential Revision: https://reviews.llvm.org/D23516
llvm-svn: 279506
2016-08-23 17:19:22 +08:00
|
|
|
bool splitFramePushPop(const MachineFunction &MF) const {
|
2016-10-12 05:14:03 +08:00
|
|
|
return (useR7AsFramePointer() &&
|
|
|
|
MF.getTarget().Options.DisableFramePointerElim(MF)) ||
|
|
|
|
isThumb1Only();
|
2016-05-14 03:16:14 +08:00
|
|
|
}
|
|
|
|
|
2015-08-04 01:20:10 +08:00
|
|
|
bool useStride4VFPs(const MachineFunction &MF) const;
|
|
|
|
|
2014-07-04 09:55:26 +08:00
|
|
|
bool useMovt(const MachineFunction &MF) const;
|
|
|
|
|
2011-10-08 01:17:49 +08:00
|
|
|
bool supportsTailCall() const { return SupportsTailCall; }
|
2009-11-24 08:44:37 +08:00
|
|
|
|
2015-07-29 06:44:28 +08:00
|
|
|
bool allowsUnalignedMem() const { return !StrictAlign; }
|
2010-09-28 12:09:35 +08:00
|
|
|
|
2013-11-14 02:29:49 +08:00
|
|
|
bool restrictIT() const { return RestrictIT; }
|
|
|
|
|
2009-05-24 03:50:50 +08:00
|
|
|
const std::string & getCPUString() const { return CPUString; }
|
2009-11-24 08:44:37 +08:00
|
|
|
|
2014-03-28 22:35:30 +08:00
|
|
|
bool isLittle() const { return IsLittle; }
|
|
|
|
|
2010-09-29 05:57:50 +08:00
|
|
|
unsigned getMispredictionPenalty() const;
|
2014-04-04 07:43:18 +08:00
|
|
|
|
2013-11-03 14:14:38 +08:00
|
|
|
/// This function returns true if the target has sincos() routine in its
|
|
|
|
/// compiler runtime or math libraries.
|
|
|
|
bool hasSinCos() const;
|
2010-12-24 12:28:06 +08:00
|
|
|
|
2015-07-18 07:18:30 +08:00
|
|
|
/// Returns true if machine scheduler should be enabled.
|
|
|
|
bool enableMachineScheduler() const override;
|
|
|
|
|
2014-06-04 15:06:27 +08:00
|
|
|
/// True for some subtargets at > -O0.
|
2015-06-13 11:42:16 +08:00
|
|
|
bool enablePostRAScheduler() const override;
|
2009-05-24 03:50:50 +08:00
|
|
|
|
2014-08-22 05:50:01 +08:00
|
|
|
// enableAtomicExpand- True if we need to expand our atomics.
|
|
|
|
bool enableAtomicExpand() const override;
|
2014-06-20 05:03:04 +08:00
|
|
|
|
2014-08-16 06:17:28 +08:00
|
|
|
/// getInstrItins - Return the instruction itineraries based on subtarget
|
2009-06-19 09:51:50 +08:00
|
|
|
/// selection.
|
2014-09-03 19:41:21 +08:00
|
|
|
const InstrItineraryData *getInstrItineraryData() const override {
|
2014-08-05 05:25:23 +08:00
|
|
|
return &InstrItins;
|
|
|
|
}
|
2009-06-19 09:51:50 +08:00
|
|
|
|
2007-01-19 15:51:42 +08:00
|
|
|
/// getStackAlignment - Returns the minimum alignment known to hold of the
|
|
|
|
/// stack frame on entry to the function and which must be maintained by every
|
|
|
|
/// function for this subtarget.
|
|
|
|
unsigned getStackAlignment() const { return stackAlignment; }
|
2009-08-29 07:18:09 +08:00
|
|
|
|
2016-06-27 17:08:23 +08:00
|
|
|
unsigned getMaxInterleaveFactor() const { return MaxInterleaveFactor; }
|
|
|
|
|
2016-07-06 19:22:11 +08:00
|
|
|
unsigned getPartialUpdateClearance() const { return PartialUpdateClearance; }
|
|
|
|
|
2016-06-27 17:08:23 +08:00
|
|
|
ARMLdStMultipleTiming getLdStMultipleTiming() const {
|
|
|
|
return LdStMultipleTiming;
|
|
|
|
}
|
|
|
|
|
|
|
|
int getPreISelOperandLatencyAdjustment() const {
|
|
|
|
return PreISelOperandLatencyAdjustment;
|
|
|
|
}
|
|
|
|
|
2016-06-28 23:38:13 +08:00
|
|
|
/// True if the GV will be accessed via an indirect symbol.
|
|
|
|
bool isGVIndirectSymbol(const GlobalValue *GV) const;
|
2014-07-16 01:18:41 +08:00
|
|
|
|
2015-05-23 09:14:08 +08:00
|
|
|
/// True if fast-isel is used.
|
|
|
|
bool useFastISel() const;
|
2017-08-29 04:20:47 +08:00
|
|
|
|
|
|
|
/// Returns the correct return opcode for the current feature set.
|
|
|
|
/// Use BX if available to allow mixing thumb/arm code, but fall back
|
|
|
|
/// to plain mov pc,lr on ARMv4.
|
|
|
|
unsigned getReturnOpcode() const {
|
|
|
|
if (isThumb())
|
|
|
|
return ARM::tBX_RET;
|
|
|
|
if (hasV4TOps())
|
|
|
|
return ARM::BX_RET;
|
|
|
|
return ARM::MOVPCLR;
|
|
|
|
}
|
2007-01-19 15:51:42 +08:00
|
|
|
};
|
|
|
|
|
2017-01-28 07:58:02 +08:00
|
|
|
} // end namespace llvm
|
|
|
|
|
|
|
|
#endif // LLVM_LIB_TARGET_ARM_ARMSUBTARGET_H
|