2007-01-19 07:51:42 +00:00
|
|
|
//=====---- ARMSubtarget.h - Define Subtarget for the ARM -----*- C++ -*--====//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-29 20:36:04 +00:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2007-01-19 07:51:42 +00:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file declares the ARM specific subclass of TargetSubtarget.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef ARMSUBTARGET_H
|
|
|
|
#define ARMSUBTARGET_H
|
|
|
|
|
2009-06-19 01:51:50 +00:00
|
|
|
#include "llvm/Target/TargetInstrItineraries.h"
|
2009-09-03 07:04:02 +00:00
|
|
|
#include "llvm/Target/TargetMachine.h"
|
2007-01-19 07:51:42 +00:00
|
|
|
#include "llvm/Target/TargetSubtarget.h"
|
2009-11-10 00:15:47 +00:00
|
|
|
#include "ARMBaseRegisterInfo.h"
|
2007-01-19 07:51:42 +00:00
|
|
|
#include <string>
|
|
|
|
|
|
|
|
namespace llvm {
|
2009-08-28 23:18:09 +00:00
|
|
|
class GlobalValue;
|
2007-01-19 07:51:42 +00:00
|
|
|
|
|
|
|
class ARMSubtarget : public TargetSubtarget {
|
|
|
|
protected:
|
|
|
|
enum ARMArchEnum {
|
2010-05-05 20:44:35 +00:00
|
|
|
V4, V4T, V5T, V5TE, V6, V6T2, V7A, V7M
|
2007-01-19 07:51:42 +00:00
|
|
|
};
|
|
|
|
|
2009-05-23 19:51:43 +00:00
|
|
|
enum ARMFPEnum {
|
|
|
|
None, VFPv2, VFPv3, NEON
|
|
|
|
};
|
|
|
|
|
2009-05-29 23:41:08 +00:00
|
|
|
enum ThumbTypeEnum {
|
|
|
|
Thumb1,
|
|
|
|
Thumb2
|
|
|
|
};
|
|
|
|
|
2010-03-06 19:39:36 +00:00
|
|
|
/// ARMArchVersion - ARM architecture version: V4, V4T (base), V5T, V5TE,
|
2010-05-05 20:44:35 +00:00
|
|
|
/// V6, V6T2, V7A, V7M.
|
2007-01-19 07:51:42 +00:00
|
|
|
ARMArchEnum ARMArchVersion;
|
|
|
|
|
2009-05-23 19:51:43 +00:00
|
|
|
/// ARMFPUType - Floating Point Unit type.
|
|
|
|
ARMFPEnum ARMFPUType;
|
2007-01-19 07:51:42 +00:00
|
|
|
|
2009-08-05 16:01:19 +00:00
|
|
|
/// UseNEONForSinglePrecisionFP - if the NEONFP attribute has been
|
|
|
|
/// specified. Use the method useNEONForSinglePrecisionFP() to
|
|
|
|
/// determine if NEON should actually be used.
|
2009-08-04 17:53:06 +00:00
|
|
|
bool UseNEONForSinglePrecisionFP;
|
|
|
|
|
2010-03-25 23:11:16 +00:00
|
|
|
/// SlowVMLx - If the VFP2 instructions are available, indicates whether
|
|
|
|
/// the VML[AS] instructions are slow (if so, don't use them).
|
|
|
|
bool SlowVMLx;
|
2010-03-24 22:31:46 +00:00
|
|
|
|
2010-07-13 19:21:50 +00:00
|
|
|
/// SlowFPBrcc - True if floating point compare + branch is slow.
|
|
|
|
bool SlowFPBrcc;
|
|
|
|
|
2009-06-01 20:00:48 +00:00
|
|
|
/// IsThumb - True if we are in thumb mode, false if in ARM mode.
|
|
|
|
bool IsThumb;
|
|
|
|
|
|
|
|
/// ThumbMode - Indicates supported Thumb version.
|
2009-05-29 23:41:08 +00:00
|
|
|
ThumbTypeEnum ThumbMode;
|
2007-01-19 07:51:42 +00:00
|
|
|
|
2009-09-30 00:10:16 +00:00
|
|
|
/// PostRAScheduler - True if using post-register-allocation scheduler.
|
|
|
|
bool PostRAScheduler;
|
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
/// IsR9Reserved - True if R9 is a not available as general purpose register.
|
|
|
|
bool IsR9Reserved;
|
2007-02-13 19:52:28 +00:00
|
|
|
|
2009-11-24 00:44:37 +00:00
|
|
|
/// UseMovt - True if MOVT / MOVW pairs are used for materialization of 32-bit
|
|
|
|
/// imms (including global addresses).
|
|
|
|
bool UseMovt;
|
|
|
|
|
2010-03-14 18:42:38 +00:00
|
|
|
/// HasFP16 - True if subtarget supports half-precision FP (We support VFP+HF
|
|
|
|
/// only so far)
|
|
|
|
bool HasFP16;
|
|
|
|
|
2010-05-05 23:44:43 +00:00
|
|
|
/// HasHardwareDivide - True if subtarget supports [su]div
|
|
|
|
bool HasHardwareDivide;
|
|
|
|
|
|
|
|
/// HasT2ExtractPack - True if subtarget supports thumb2 extract/pack
|
|
|
|
/// instructions.
|
|
|
|
bool HasT2ExtractPack;
|
|
|
|
|
2010-08-09 18:35:19 +00:00
|
|
|
/// Pref32BitThumb - If true, codegen would prefer 32-bit Thumb instructions
|
|
|
|
/// over 16-bit ones.
|
|
|
|
bool Pref32BitThumb;
|
|
|
|
|
2007-01-19 07:51:42 +00: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.
|
|
|
|
unsigned stackAlignment;
|
|
|
|
|
2009-05-23 19:50:50 +00:00
|
|
|
/// CPUString - String name of used CPU.
|
|
|
|
std::string CPUString;
|
|
|
|
|
2009-06-19 01:51:50 +00:00
|
|
|
/// Selected instruction itineraries (one entry per itinerary class.)
|
|
|
|
InstrItineraryData InstrItins;
|
2009-08-11 15:33:49 +00:00
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
public:
|
2007-01-19 19:22:40 +00:00
|
|
|
enum {
|
|
|
|
isELF, isDarwin
|
|
|
|
} TargetType;
|
|
|
|
|
2007-02-13 19:52:28 +00:00
|
|
|
enum {
|
|
|
|
ARM_ABI_APCS,
|
|
|
|
ARM_ABI_AAPCS // ARM EABI
|
|
|
|
} TargetABI;
|
|
|
|
|
2007-01-19 07:51:42 +00:00
|
|
|
/// This constructor initializes the data members to match that
|
2009-08-02 22:11:08 +00:00
|
|
|
/// of the specified triple.
|
2007-01-19 07:51:42 +00:00
|
|
|
///
|
2009-08-02 22:11:08 +00:00
|
|
|
ARMSubtarget(const std::string &TT, const std::string &FS, bool isThumb);
|
2007-01-19 07:51:42 +00: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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49572 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-12 04:36:06 +00:00
|
|
|
/// getMaxInlineSizeThreshold - Returns the maximum memset / memcpy size
|
|
|
|
/// that still makes it profitable to inline the call.
|
2007-10-31 14:39:58 +00:00
|
|
|
unsigned getMaxInlineSizeThreshold() const {
|
2010-03-11 00:20:49 +00:00
|
|
|
// FIXME: For now, we don't lower memcpy's to loads / stores for Thumb1.
|
|
|
|
// Change this once Thumb1 ldmia / stmia support is added.
|
|
|
|
return isThumb1Only() ? 0 : 64;
|
2007-10-31 14:39:58 +00:00
|
|
|
}
|
2009-05-23 19:51:43 +00:00
|
|
|
/// ParseSubtargetFeatures - Parses features string setting specified
|
2007-01-19 07:51:42 +00:00
|
|
|
/// subtarget options. Definition of function is auto generated by tblgen.
|
2009-05-23 19:50:50 +00:00
|
|
|
std::string ParseSubtargetFeatures(const std::string &FS,
|
|
|
|
const std::string &CPU);
|
2007-01-19 07:51:42 +00:00
|
|
|
|
2009-05-23 19:51:43 +00:00
|
|
|
bool hasV4TOps() const { return ARMArchVersion >= V4T; }
|
|
|
|
bool hasV5TOps() const { return ARMArchVersion >= V5T; }
|
2007-01-19 07:51:42 +00:00
|
|
|
bool hasV5TEOps() const { return ARMArchVersion >= V5TE; }
|
2009-05-23 19:51:43 +00:00
|
|
|
bool hasV6Ops() const { return ARMArchVersion >= V6; }
|
2009-06-25 16:03:07 +00:00
|
|
|
bool hasV6T2Ops() const { return ARMArchVersion >= V6T2; }
|
2009-05-23 19:51:43 +00:00
|
|
|
bool hasV7Ops() const { return ARMArchVersion >= V7A; }
|
2007-01-19 07:51:42 +00:00
|
|
|
|
2009-05-23 19:51:43 +00:00
|
|
|
bool hasVFP2() const { return ARMFPUType >= VFPv2; }
|
|
|
|
bool hasVFP3() const { return ARMFPUType >= VFPv3; }
|
|
|
|
bool hasNEON() const { return ARMFPUType >= NEON; }
|
2009-08-11 15:33:49 +00:00
|
|
|
bool useNEONForSinglePrecisionFP() const {
|
2009-08-04 17:53:06 +00:00
|
|
|
return hasNEON() && UseNEONForSinglePrecisionFP; }
|
2010-05-06 14:57:47 +00:00
|
|
|
bool hasDivide() const { return HasHardwareDivide; }
|
|
|
|
bool hasT2ExtractPack() const { return HasT2ExtractPack; }
|
2010-03-25 23:11:16 +00:00
|
|
|
bool useVMLx() const {return hasVFP2() && !SlowVMLx; }
|
2010-07-13 19:21:50 +00:00
|
|
|
bool isFPBrccSlow() const { return SlowFPBrcc; }
|
2010-08-09 18:35:19 +00:00
|
|
|
bool prefers32BitThumb() const { return Pref32BitThumb; }
|
2009-08-11 15:33:49 +00:00
|
|
|
|
2010-03-14 18:42:38 +00:00
|
|
|
bool hasFP16() const { return HasFP16; }
|
|
|
|
|
2007-01-19 19:22:40 +00:00
|
|
|
bool isTargetDarwin() const { return TargetType == isDarwin; }
|
|
|
|
bool isTargetELF() const { return TargetType == isELF; }
|
|
|
|
|
2007-02-13 19:52:28 +00:00
|
|
|
bool isAPCS_ABI() const { return TargetABI == ARM_ABI_APCS; }
|
|
|
|
bool isAAPCS_ABI() const { return TargetABI == ARM_ABI_AAPCS; }
|
|
|
|
|
2009-06-01 20:00:48 +00:00
|
|
|
bool isThumb() const { return IsThumb; }
|
2009-06-15 21:46:20 +00:00
|
|
|
bool isThumb1Only() const { return IsThumb && (ThumbMode == Thumb1); }
|
2009-07-06 22:29:14 +00:00
|
|
|
bool isThumb2() const { return IsThumb && (ThumbMode == Thumb2); }
|
2009-07-02 06:38:40 +00:00
|
|
|
bool hasThumb2() const { return ThumbMode >= Thumb2; }
|
2007-01-19 07:51:42 +00:00
|
|
|
|
|
|
|
bool isR9Reserved() const { return IsR9Reserved; }
|
|
|
|
|
2009-11-24 00:44:37 +00:00
|
|
|
bool useMovt() const { return UseMovt && hasV6T2Ops(); }
|
|
|
|
|
2009-05-23 19:50:50 +00:00
|
|
|
const std::string & getCPUString() const { return CPUString; }
|
2009-11-24 00:44:37 +00:00
|
|
|
|
2009-11-10 00:48:55 +00:00
|
|
|
/// enablePostRAScheduler - True at 'More' optimization.
|
2009-10-22 23:19:17 +00:00
|
|
|
bool enablePostRAScheduler(CodeGenOpt::Level OptLevel,
|
2009-11-10 00:15:47 +00:00
|
|
|
TargetSubtarget::AntiDepBreakMode& Mode,
|
2009-11-13 19:52:48 +00:00
|
|
|
RegClassVector& CriticalPathRCs) const;
|
2009-05-23 19:50:50 +00:00
|
|
|
|
2009-08-11 15:33:49 +00:00
|
|
|
/// getInstrItins - Return the instruction itineraies based on subtarget
|
2009-06-19 01:51:50 +00:00
|
|
|
/// selection.
|
|
|
|
const InstrItineraryData &getInstrItineraryData() const { return InstrItins; }
|
|
|
|
|
2007-01-19 07:51:42 +00: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-28 23:18:09 +00:00
|
|
|
|
|
|
|
/// GVIsIndirectSymbol - true if the GV will be accessed via an indirect
|
|
|
|
/// symbol.
|
2010-04-15 01:51:59 +00:00
|
|
|
bool GVIsIndirectSymbol(const GlobalValue *GV, Reloc::Model RelocM) const;
|
2007-01-19 07:51:42 +00:00
|
|
|
};
|
|
|
|
} // End llvm namespace
|
|
|
|
|
|
|
|
#endif // ARMSUBTARGET_H
|