blob: 31194ae61059d2b3c475975d3d76ef11ca71ce80 [file] [log] [blame]
Jia Liubb481f82012-02-28 07:46:26 +00001//===-- Mips.td - Describe the Mips Target Machine ---------*- tablegen -*-===//
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +00002//
3// The LLVM Compiler Infrastructure
4//
Chris Lattner4ee451d2007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +00007//
Akira Hatanaka4552c9a2011-04-15 21:51:11 +00008//===----------------------------------------------------------------------===//
Bruno Cardoso Lopes6d32ca02007-08-18 02:18:07 +00009// This is the top level entry point for the Mips target.
Akira Hatanaka4552c9a2011-04-15 21:51:11 +000010//===----------------------------------------------------------------------===//
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000011
Akira Hatanaka4552c9a2011-04-15 21:51:11 +000012//===----------------------------------------------------------------------===//
Bruno Cardoso Lopes6d32ca02007-08-18 02:18:07 +000013// Target-independent interfaces
Akira Hatanaka4552c9a2011-04-15 21:51:11 +000014//===----------------------------------------------------------------------===//
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000015
Evan Cheng027fdbe2008-11-24 07:34:46 +000016include "llvm/Target/Target.td"
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000017
Akira Hatanaka4552c9a2011-04-15 21:51:11 +000018//===----------------------------------------------------------------------===//
Bruno Cardoso Lopes225ca9c2008-07-05 19:05:21 +000019// Register File, Calling Conv, Instruction Descriptions
Akira Hatanaka4552c9a2011-04-15 21:51:11 +000020//===----------------------------------------------------------------------===//
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000021
22include "MipsRegisterInfo.td"
Bruno Cardoso Lopes6d32ca02007-08-18 02:18:07 +000023include "MipsSchedule.td"
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000024include "MipsInstrInfo.td"
Bruno Cardoso Lopes6d32ca02007-08-18 02:18:07 +000025include "MipsCallingConv.td"
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000026
Jakob Stoklund Olesenfddb7662010-04-05 03:10:20 +000027def MipsInstrInfo : InstrInfo;
Bruno Cardoso Lopes6d32ca02007-08-18 02:18:07 +000028
Akira Hatanaka4552c9a2011-04-15 21:51:11 +000029//===----------------------------------------------------------------------===//
30// Mips Subtarget features //
31//===----------------------------------------------------------------------===//
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000032
Bruno Cardoso Lopes7728f7e2008-07-09 05:32:22 +000033def FeatureGP64Bit : SubtargetFeature<"gp64", "IsGP64bit", "true",
Bruno Cardoso Lopes225ca9c2008-07-05 19:05:21 +000034 "General Purpose Registers are 64-bit wide.">;
Bruno Cardoso Lopes7728f7e2008-07-09 05:32:22 +000035def FeatureFP64Bit : SubtargetFeature<"fp64", "IsFP64bit", "true",
Bruno Cardoso Lopes225ca9c2008-07-05 19:05:21 +000036 "Support 64-bit FP registers.">;
Bruno Cardoso Lopes7728f7e2008-07-09 05:32:22 +000037def FeatureSingleFloat : SubtargetFeature<"single-float", "IsSingleFloat",
Akira Hatanaka4552c9a2011-04-15 21:51:11 +000038 "true", "Only supports single precision float">;
Bruno Cardoso Lopes7728f7e2008-07-09 05:32:22 +000039def FeatureO32 : SubtargetFeature<"o32", "MipsABI", "O32",
Bruno Cardoso Lopes225ca9c2008-07-05 19:05:21 +000040 "Enable o32 ABI">;
Akira Hatanaka1daa5be2011-09-20 20:28:08 +000041def FeatureN32 : SubtargetFeature<"n32", "MipsABI", "N32",
42 "Enable n32 ABI">;
43def FeatureN64 : SubtargetFeature<"n64", "MipsABI", "N64",
44 "Enable n64 ABI">;
Bruno Cardoso Lopes7728f7e2008-07-09 05:32:22 +000045def FeatureEABI : SubtargetFeature<"eabi", "MipsABI", "EABI",
Bruno Cardoso Lopes225ca9c2008-07-05 19:05:21 +000046 "Enable eabi ABI">;
Akira Hatanakabb2e1b52012-08-16 03:48:05 +000047def FeatureAndroid : SubtargetFeature<"android", "IsAndroid", "true",
48 "Target is android">;
Bruno Cardoso Lopes2c2304c2010-11-08 21:42:32 +000049def FeatureVFPU : SubtargetFeature<"vfpu", "HasVFPU",
Bruno Cardoso Lopes7728f7e2008-07-09 05:32:22 +000050 "true", "Enable vector FPU instructions.">;
Bruno Cardoso Lopes2c2304c2010-11-08 21:42:32 +000051def FeatureSEInReg : SubtargetFeature<"seinreg", "HasSEInReg", "true",
Bruno Cardoso Lopes7728f7e2008-07-09 05:32:22 +000052 "Enable 'signext in register' instructions.">;
Bruno Cardoso Lopes2c2304c2010-11-08 21:42:32 +000053def FeatureCondMov : SubtargetFeature<"condmov", "HasCondMov", "true",
Bruno Cardoso Lopesd3a680d2008-07-30 17:01:06 +000054 "Enable 'conditional move' instructions.">;
55def FeatureMulDivAdd : SubtargetFeature<"muldivadd", "HasMulDivAdd", "true",
56 "Enable 'multiply add/sub' instructions.">;
57def FeatureMinMax : SubtargetFeature<"minmax", "HasMinMax", "true",
58 "Enable 'min/max' instructions.">;
59def FeatureSwap : SubtargetFeature<"swap", "HasSwap", "true",
60 "Enable 'byte/half swap' instructions.">;
61def FeatureBitCount : SubtargetFeature<"bitcount", "HasBitCount", "true",
62 "Enable 'count leading bits' instructions.">;
Akira Hatanaka0301bc52012-11-15 21:17:13 +000063def FeatureFPIdx : SubtargetFeature<"FPIdx", "HasFPIdx", "true",
64 "Enable 'FP indexed load/store' instructions.">;
Akira Hatanaka4552c9a2011-04-15 21:51:11 +000065def FeatureMips32 : SubtargetFeature<"mips32", "MipsArchVersion", "Mips32",
66 "Mips32 ISA Support",
Bruno Cardoso Lopesc4bb67c2010-11-10 02:13:22 +000067 [FeatureCondMov, FeatureBitCount]>;
Bruno Cardoso Lopes2c2304c2010-11-08 21:42:32 +000068def FeatureMips32r2 : SubtargetFeature<"mips32r2", "MipsArchVersion",
69 "Mips32r2", "Mips32r2 ISA Support",
Akira Hatanaka0301bc52012-11-15 21:17:13 +000070 [FeatureMips32, FeatureSEInReg, FeatureSwap,
71 FeatureFPIdx]>;
Akira Hatanaka1daa5be2011-09-20 20:28:08 +000072def FeatureMips64 : SubtargetFeature<"mips64", "MipsArchVersion",
73 "Mips64", "Mips64 ISA Support",
74 [FeatureGP64Bit, FeatureFP64Bit,
Akira Hatanaka0301bc52012-11-15 21:17:13 +000075 FeatureMips32, FeatureFPIdx]>;
Akira Hatanaka1daa5be2011-09-20 20:28:08 +000076def FeatureMips64r2 : SubtargetFeature<"mips64r2", "MipsArchVersion",
77 "Mips64r2", "Mips64r2 ISA Support",
78 [FeatureMips64, FeatureMips32r2]>;
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000079
Akira Hatanaka66e19c32012-05-16 22:19:56 +000080def FeatureMips16 : SubtargetFeature<"mips16", "InMips16Mode", "true",
81 "Mips16 mode">;
82
Akira Hatanakaa9adbf62012-09-21 23:41:49 +000083def FeatureDSP : SubtargetFeature<"dsp", "HasDSP", "true", "Mips DSP ASE">;
84def FeatureDSPR2 : SubtargetFeature<"dspr2", "HasDSPR2", "true",
85 "Mips DSP-R2 ASE", [FeatureDSP]>;
86
Akira Hatanaka4552c9a2011-04-15 21:51:11 +000087//===----------------------------------------------------------------------===//
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000088// Mips processors supported.
Akira Hatanaka4552c9a2011-04-15 21:51:11 +000089//===----------------------------------------------------------------------===//
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000090
Bruno Cardoso Lopes225ca9c2008-07-05 19:05:21 +000091class Proc<string Name, list<SubtargetFeature> Features>
92 : Processor<Name, MipsGenericItineraries, Features>;
93
Akira Hatanakaed2a7d22011-11-29 23:08:41 +000094def : Proc<"mips32", [FeatureMips32]>;
95def : Proc<"mips32r2", [FeatureMips32r2]>;
96def : Proc<"mips64", [FeatureMips64]>;
Akira Hatanaka1daa5be2011-09-20 20:28:08 +000097def : Proc<"mips64r2", [FeatureMips64r2]>;
Akira Hatanaka66e19c32012-05-16 22:19:56 +000098def : Proc<"mips16", [FeatureMips16]>;
Bruno Cardoso Lopes2c2304c2010-11-08 21:42:32 +000099
Akira Hatanaka794bf172011-07-07 23:56:50 +0000100def MipsAsmWriter : AsmWriter {
101 string AsmWriterClassName = "InstPrinter";
102 bit isMCAsmWriter = 1;
103}
104
Akira Hatanaka72e9b6a2012-08-17 20:16:42 +0000105def MipsAsmParser : AsmParser {
106 let ShouldEmitMatchRegisterName = 0;
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +0000107}
Akira Hatanaka794bf172011-07-07 23:56:50 +0000108
Akira Hatanaka72e9b6a2012-08-17 20:16:42 +0000109def MipsAsmParserVariant : AsmParserVariant {
110 int Variant = 0;
111
112 // Recognize hard coded registers.
113 string RegisterPrefix = "$";
114}
115
116def Mips : Target {
117 let InstructionSet = MipsInstrInfo;
118 let AssemblyParsers = [MipsAsmParser];
119 let AssemblyWriters = [MipsAsmWriter];
120 let AssemblyParserVariants = [MipsAsmParserVariant];
121}