2010-08-18 00:20:04 +08:00
|
|
|
//===- ARM.td - Describe the ARM Target Machine ------------*- tablegen -*-===//
|
2006-05-15 06:18:28 +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
|
2006-05-15 06:18:28 +08:00
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Target-independent interfaces which we are implementing
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2008-11-24 15:34:46 +08:00
|
|
|
include "llvm/Target/Target.td"
|
2006-05-15 06:18:28 +08:00
|
|
|
|
2011-07-07 16:26:46 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// ARM Subtarget state.
|
|
|
|
//
|
|
|
|
|
|
|
|
def ModeThumb : SubtargetFeature<"thumb", "IsThumb", "true",
|
|
|
|
"Thumb mode">;
|
2010-09-30 09:57:53 +08:00
|
|
|
|
2007-01-19 15:51:42 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// ARM Subtarget features.
|
|
|
|
//
|
|
|
|
|
2011-07-07 11:55:05 +08:00
|
|
|
def FeatureVFP2 : SubtargetFeature<"vfp2", "HasVFPv2", "true",
|
2009-05-30 07:41:08 +08:00
|
|
|
"Enable VFP2 instructions">;
|
2011-07-07 11:55:05 +08:00
|
|
|
def FeatureVFP3 : SubtargetFeature<"vfp3", "HasVFPv3", "true",
|
|
|
|
"Enable VFP3 instructions",
|
|
|
|
[FeatureVFP2]>;
|
|
|
|
def FeatureNEON : SubtargetFeature<"neon", "HasNEON", "true",
|
|
|
|
"Enable NEON instructions",
|
|
|
|
[FeatureVFP3]>;
|
2011-07-07 08:08:19 +08:00
|
|
|
def FeatureThumb2 : SubtargetFeature<"thumb2", "HasThumb2", "true",
|
2009-05-30 07:41:08 +08:00
|
|
|
"Enable Thumb2 instructions">;
|
2010-08-11 15:17:46 +08:00
|
|
|
def FeatureNoARM : SubtargetFeature<"noarm", "NoARM", "true",
|
|
|
|
"Does not support ARM mode execution">;
|
2010-03-15 02:42:38 +08:00
|
|
|
def FeatureFP16 : SubtargetFeature<"fp16", "HasFP16", "true",
|
|
|
|
"Enable half-precision floating point">;
|
2010-10-13 00:22:47 +08:00
|
|
|
def FeatureD16 : SubtargetFeature<"d16", "HasD16", "true",
|
|
|
|
"Restrict VFP3 to 16 double registers">;
|
2010-05-06 07:44:43 +08:00
|
|
|
def FeatureHWDiv : SubtargetFeature<"hwdiv", "HasHardwareDivide", "true",
|
|
|
|
"Enable divide instructions">;
|
2010-08-11 14:51:54 +08:00
|
|
|
def FeatureT2XtPk : SubtargetFeature<"t2xtpk", "HasT2ExtractPack", "true",
|
2010-05-06 07:44:43 +08:00
|
|
|
"Enable Thumb2 extract and pack instructions">;
|
2010-08-11 14:51:54 +08:00
|
|
|
def FeatureDB : SubtargetFeature<"db", "HasDataBarrier", "true",
|
|
|
|
"Has data barrier (dmb / dsb) instructions">;
|
2010-07-14 03:21:50 +08:00
|
|
|
def FeatureSlowFPBrcc : SubtargetFeature<"slow-fp-brcc", "SlowFPBrcc", "true",
|
|
|
|
"FP compare + branch is slow">;
|
2010-08-11 23:44:15 +08:00
|
|
|
def FeatureVFPOnlySP : SubtargetFeature<"fp-only-sp", "FPOnlySP", "true",
|
|
|
|
"Floating point unit supports single precision only">;
|
2007-01-19 15:51:42 +08:00
|
|
|
|
2010-12-06 06:04:16 +08:00
|
|
|
// Some processors have FP multiply-accumulate instructions that don't
|
|
|
|
// play nicely with other VFP / NEON instructions, and it's generally better
|
2010-03-26 07:11:16 +08:00
|
|
|
// to just not use them.
|
2010-12-06 06:04:16 +08:00
|
|
|
def FeatureHasSlowFPVMLx : SubtargetFeature<"slowfpvmlx", "SlowFPVMLx", "true",
|
|
|
|
"Disable VFP / NEON MAC instructions">;
|
2011-04-01 03:38:48 +08:00
|
|
|
|
|
|
|
// Cortex-A8 / A9 Advanced SIMD has multiplier accumulator forwarding.
|
|
|
|
def FeatureVMLxForwarding : SubtargetFeature<"vmlx-forwarding",
|
|
|
|
"HasVMLxForwarding", "true",
|
|
|
|
"Has multiplier accumulator forwarding">;
|
|
|
|
|
2010-03-26 07:47:34 +08:00
|
|
|
// Some processors benefit from using NEON instructions for scalar
|
|
|
|
// single-precision FP operations.
|
2010-08-18 02:39:16 +08:00
|
|
|
def FeatureNEONForFP : SubtargetFeature<"neonfp", "UseNEONForSinglePrecisionFP",
|
|
|
|
"true",
|
|
|
|
"Use NEON for single precision FP">;
|
2010-03-26 07:47:34 +08:00
|
|
|
|
2010-08-10 02:35:19 +08:00
|
|
|
// Disable 32-bit to 16-bit narrowing for experimentation.
|
|
|
|
def FeaturePref32BitThumb : SubtargetFeature<"32bit", "Pref32BitThumb", "true",
|
|
|
|
"Prefer 32-bit Thumb instrs">;
|
2010-03-26 07:11:16 +08:00
|
|
|
|
2011-04-20 02:11:49 +08:00
|
|
|
/// Some instructions update CPSR partially, which can add false dependency for
|
|
|
|
/// out-of-order implementation, e.g. Cortex-A9, unless each individual bit is
|
|
|
|
/// mapped to a separate physical register. Avoid partial CPSR update for these
|
|
|
|
/// processors.
|
|
|
|
def FeatureAvoidPartialCPSR : SubtargetFeature<"avoid-partial-cpsr",
|
|
|
|
"AvoidCPSRPartialUpdate", "true",
|
|
|
|
"Avoid CPSR partial update for OOO execution">;
|
|
|
|
|
2011-07-02 05:12:19 +08:00
|
|
|
/// Some M architectures don't have the DSP extension (v7E-M vs. v7M)
|
|
|
|
def FeatureDSPThumb2 : SubtargetFeature<"t2dsp", "Thumb2DSP", "true",
|
|
|
|
"Supports v7 DSP instructions in Thumb2.">;
|
|
|
|
|
2010-11-03 14:34:55 +08:00
|
|
|
// Multiprocessing extension.
|
|
|
|
def FeatureMP : SubtargetFeature<"mp", "HasMPExtension", "true",
|
|
|
|
"Supports Multiprocessing extension">;
|
2010-08-11 14:51:54 +08:00
|
|
|
|
2011-07-07 16:26:46 +08:00
|
|
|
// ARM ISAs.
|
2011-07-07 11:55:05 +08:00
|
|
|
def HasV4TOps : SubtargetFeature<"v4t", "HasV4TOps", "true",
|
2011-07-07 16:26:46 +08:00
|
|
|
"Support ARM v4T instructions">;
|
2011-07-07 11:55:05 +08:00
|
|
|
def HasV5TOps : SubtargetFeature<"v5t", "HasV5TOps", "true",
|
2011-07-07 16:26:46 +08:00
|
|
|
"Support ARM v5T instructions",
|
2011-07-07 11:55:05 +08:00
|
|
|
[HasV4TOps]>;
|
|
|
|
def HasV5TEOps : SubtargetFeature<"v5te", "HasV5TEOps", "true",
|
2011-07-07 16:26:46 +08:00
|
|
|
"Support ARM v5TE, v5TEj, and v5TExp instructions",
|
2011-07-07 11:55:05 +08:00
|
|
|
[HasV5TOps]>;
|
|
|
|
def HasV6Ops : SubtargetFeature<"v6", "HasV6Ops", "true",
|
2011-07-07 16:26:46 +08:00
|
|
|
"Support ARM v6 instructions",
|
2011-07-07 11:55:05 +08:00
|
|
|
[HasV5TEOps]>;
|
|
|
|
def HasV6T2Ops : SubtargetFeature<"v6t2", "HasV6T2Ops", "true",
|
2011-07-07 16:26:46 +08:00
|
|
|
"Support ARM v6t2 instructions",
|
2011-07-07 11:55:05 +08:00
|
|
|
[HasV6Ops, FeatureThumb2, FeatureDSPThumb2]>;
|
|
|
|
def HasV7Ops : SubtargetFeature<"v7", "HasV7Ops", "true",
|
2011-07-07 16:26:46 +08:00
|
|
|
"Support ARM v7 instructions",
|
2011-07-07 11:55:05 +08:00
|
|
|
[HasV6T2Ops]>;
|
2010-08-11 14:51:54 +08:00
|
|
|
|
2007-01-19 15:51:42 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// ARM Processors supported.
|
|
|
|
//
|
|
|
|
|
2009-06-19 09:51:50 +08:00
|
|
|
include "ARMSchedule.td"
|
|
|
|
|
2010-09-10 09:29:16 +08:00
|
|
|
// ARM processor families.
|
|
|
|
def ProcA8 : SubtargetFeature<"a8", "ARMProcFamily", "CortexA8",
|
|
|
|
"Cortex-A8 ARM processors",
|
2010-12-06 07:03:45 +08:00
|
|
|
[FeatureSlowFPBrcc, FeatureNEONForFP,
|
2011-04-01 03:38:48 +08:00
|
|
|
FeatureHasSlowFPVMLx, FeatureVMLxForwarding,
|
|
|
|
FeatureT2XtPk]>;
|
2010-09-10 09:29:16 +08:00
|
|
|
def ProcA9 : SubtargetFeature<"a9", "ARMProcFamily", "CortexA9",
|
2010-12-06 07:03:45 +08:00
|
|
|
"Cortex-A9 ARM processors",
|
2011-04-20 02:11:57 +08:00
|
|
|
[FeatureVMLxForwarding,
|
2011-04-20 02:11:49 +08:00
|
|
|
FeatureT2XtPk, FeatureFP16,
|
|
|
|
FeatureAvoidPartialCPSR]>;
|
2010-09-10 09:29:16 +08:00
|
|
|
|
2009-06-19 09:51:50 +08:00
|
|
|
class ProcNoItin<string Name, list<SubtargetFeature> Features>
|
|
|
|
: Processor<Name, GenericItineraries, Features>;
|
2007-01-19 15:51:42 +08:00
|
|
|
|
|
|
|
// V4 Processors.
|
2009-06-19 09:51:50 +08:00
|
|
|
def : ProcNoItin<"generic", []>;
|
|
|
|
def : ProcNoItin<"arm8", []>;
|
|
|
|
def : ProcNoItin<"arm810", []>;
|
|
|
|
def : ProcNoItin<"strongarm", []>;
|
|
|
|
def : ProcNoItin<"strongarm110", []>;
|
|
|
|
def : ProcNoItin<"strongarm1100", []>;
|
|
|
|
def : ProcNoItin<"strongarm1110", []>;
|
2007-01-19 15:51:42 +08:00
|
|
|
|
|
|
|
// V4T Processors.
|
2011-07-07 11:55:05 +08:00
|
|
|
def : ProcNoItin<"arm7tdmi", [HasV4TOps]>;
|
|
|
|
def : ProcNoItin<"arm7tdmi-s", [HasV4TOps]>;
|
|
|
|
def : ProcNoItin<"arm710t", [HasV4TOps]>;
|
|
|
|
def : ProcNoItin<"arm720t", [HasV4TOps]>;
|
|
|
|
def : ProcNoItin<"arm9", [HasV4TOps]>;
|
|
|
|
def : ProcNoItin<"arm9tdmi", [HasV4TOps]>;
|
|
|
|
def : ProcNoItin<"arm920", [HasV4TOps]>;
|
|
|
|
def : ProcNoItin<"arm920t", [HasV4TOps]>;
|
|
|
|
def : ProcNoItin<"arm922t", [HasV4TOps]>;
|
|
|
|
def : ProcNoItin<"arm940t", [HasV4TOps]>;
|
|
|
|
def : ProcNoItin<"ep9312", [HasV4TOps]>;
|
2007-01-19 15:51:42 +08:00
|
|
|
|
|
|
|
// V5T Processors.
|
2011-07-07 11:55:05 +08:00
|
|
|
def : ProcNoItin<"arm10tdmi", [HasV5TOps]>;
|
|
|
|
def : ProcNoItin<"arm1020t", [HasV5TOps]>;
|
2007-01-19 15:51:42 +08:00
|
|
|
|
|
|
|
// V5TE Processors.
|
2011-07-07 11:55:05 +08:00
|
|
|
def : ProcNoItin<"arm9e", [HasV5TEOps]>;
|
|
|
|
def : ProcNoItin<"arm926ej-s", [HasV5TEOps]>;
|
|
|
|
def : ProcNoItin<"arm946e-s", [HasV5TEOps]>;
|
|
|
|
def : ProcNoItin<"arm966e-s", [HasV5TEOps]>;
|
|
|
|
def : ProcNoItin<"arm968e-s", [HasV5TEOps]>;
|
|
|
|
def : ProcNoItin<"arm10e", [HasV5TEOps]>;
|
|
|
|
def : ProcNoItin<"arm1020e", [HasV5TEOps]>;
|
|
|
|
def : ProcNoItin<"arm1022e", [HasV5TEOps]>;
|
|
|
|
def : ProcNoItin<"xscale", [HasV5TEOps]>;
|
|
|
|
def : ProcNoItin<"iwmmxt", [HasV5TEOps]>;
|
2007-01-19 15:51:42 +08:00
|
|
|
|
|
|
|
// V6 Processors.
|
2011-07-07 11:55:05 +08:00
|
|
|
def : Processor<"arm1136j-s", ARMV6Itineraries, [HasV6Ops]>;
|
|
|
|
def : Processor<"arm1136jf-s", ARMV6Itineraries, [HasV6Ops, FeatureVFP2,
|
2010-12-06 06:04:16 +08:00
|
|
|
FeatureHasSlowFPVMLx]>;
|
2011-07-07 11:55:05 +08:00
|
|
|
def : Processor<"arm1176jz-s", ARMV6Itineraries, [HasV6Ops]>;
|
|
|
|
def : Processor<"arm1176jzf-s", ARMV6Itineraries, [HasV6Ops, FeatureVFP2,
|
2010-12-06 06:04:16 +08:00
|
|
|
FeatureHasSlowFPVMLx]>;
|
2011-07-07 11:55:05 +08:00
|
|
|
def : Processor<"mpcorenovfp", ARMV6Itineraries, [HasV6Ops]>;
|
|
|
|
def : Processor<"mpcore", ARMV6Itineraries, [HasV6Ops, FeatureVFP2,
|
2010-12-06 06:04:16 +08:00
|
|
|
FeatureHasSlowFPVMLx]>;
|
2007-01-19 15:51:42 +08:00
|
|
|
|
2010-08-11 14:30:38 +08:00
|
|
|
// V6M Processors.
|
2011-07-07 11:55:05 +08:00
|
|
|
def : Processor<"cortex-m0", ARMV6Itineraries, [HasV6Ops, FeatureNoARM,
|
|
|
|
FeatureDB]>;
|
2010-08-11 14:30:38 +08:00
|
|
|
|
2009-06-09 05:20:36 +08:00
|
|
|
// V6T2 Processors.
|
2011-07-07 11:55:05 +08:00
|
|
|
def : Processor<"arm1156t2-s", ARMV6Itineraries, [HasV6T2Ops]>;
|
|
|
|
def : Processor<"arm1156t2f-s", ARMV6Itineraries, [HasV6T2Ops, FeatureVFP2,
|
2010-12-06 06:04:16 +08:00
|
|
|
FeatureHasSlowFPVMLx]>;
|
2009-05-30 07:41:08 +08:00
|
|
|
|
2011-07-07 11:55:05 +08:00
|
|
|
// V7a Processors.
|
2009-07-22 02:54:14 +08:00
|
|
|
def : Processor<"cortex-a8", CortexA8Itineraries,
|
2011-07-07 11:55:05 +08:00
|
|
|
[ProcA8, HasV7Ops, FeatureNEON, FeatureDB,
|
|
|
|
FeatureDSPThumb2]>;
|
2010-04-08 02:19:18 +08:00
|
|
|
def : Processor<"cortex-a9", CortexA9Itineraries,
|
2011-07-07 11:55:05 +08:00
|
|
|
[ProcA9, HasV7Ops, FeatureNEON, FeatureDB,
|
|
|
|
FeatureDSPThumb2]>;
|
2011-04-20 02:11:52 +08:00
|
|
|
def : Processor<"cortex-a9-mp", CortexA9Itineraries,
|
2011-07-07 11:55:05 +08:00
|
|
|
[ProcA9, HasV7Ops, FeatureNEON, FeatureDB,
|
|
|
|
FeatureDSPThumb2, FeatureMP]>;
|
2010-08-11 14:30:38 +08:00
|
|
|
|
|
|
|
// V7M Processors.
|
2011-07-07 11:55:05 +08:00
|
|
|
def : ProcNoItin<"cortex-m3", [HasV7Ops,
|
|
|
|
FeatureThumb2, FeatureNoARM, FeatureDB,
|
|
|
|
FeatureHWDiv]>;
|
|
|
|
|
|
|
|
// V7EM Processors.
|
|
|
|
def : ProcNoItin<"cortex-m4", [HasV7Ops,
|
|
|
|
FeatureThumb2, FeatureNoARM, FeatureDB,
|
|
|
|
FeatureHWDiv, FeatureDSPThumb2,
|
|
|
|
FeatureT2XtPk, FeatureVFP2,
|
|
|
|
FeatureVFPOnlySP]>;
|
2009-05-24 03:51:43 +08:00
|
|
|
|
2006-05-15 06:18:28 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Register File Description
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
include "ARMRegisterInfo.td"
|
|
|
|
|
2009-04-18 03:07:39 +08:00
|
|
|
include "ARMCallingConv.td"
|
|
|
|
|
2006-05-15 06:18:28 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Instruction Descriptions
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
include "ARMInstrInfo.td"
|
|
|
|
|
2010-04-05 11:10:20 +08:00
|
|
|
def ARMInstrInfo : InstrInfo;
|
2006-05-15 06:18:28 +08:00
|
|
|
|
2010-09-30 09:57:53 +08:00
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Assembly printer
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// ARM Uses the MC printer for asm output, so make sure the TableGen
|
|
|
|
// AsmWriter bits get associated with the correct class.
|
|
|
|
def ARMAsmWriter : AsmWriter {
|
|
|
|
string AsmWriterClassName = "InstPrinter";
|
|
|
|
bit isMCAsmWriter = 1;
|
|
|
|
}
|
|
|
|
|
2006-05-15 06:18:28 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Declare the target which we are implementing
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
def ARM : Target {
|
|
|
|
// Pull in Instruction Info:
|
|
|
|
let InstructionSet = ARMInstrInfo;
|
2010-09-30 09:57:53 +08:00
|
|
|
|
|
|
|
let AssemblyWriters = [ARMAsmWriter];
|
2006-05-15 06:18:28 +08:00
|
|
|
}
|