blob: 10a469972f4cf20cbcdb39ab3b5886defdfb9e64 [file] [log] [blame]
Jia Liuf54f60f2012-02-28 07:46:26 +00001//===-- Mips.td - Describe the Mips Target Machine ---------*- tablegen -*-===//
Bruno Cardoso Lopes35e43c42007-06-06 07:42:06 +00002//
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
6// License. See LICENSE.TXT for details.
Bruno Cardoso Lopes35e43c42007-06-06 07:42:06 +00007//
Akira Hatanakae2489122011-04-15 21:51:11 +00008//===----------------------------------------------------------------------===//
Bruno Cardoso Lopesf3c55802007-08-18 02:18:07 +00009// This is the top level entry point for the Mips target.
Akira Hatanakae2489122011-04-15 21:51:11 +000010//===----------------------------------------------------------------------===//
Bruno Cardoso Lopes35e43c42007-06-06 07:42:06 +000011
Akira Hatanakae2489122011-04-15 21:51:11 +000012//===----------------------------------------------------------------------===//
Bruno Cardoso Lopesf3c55802007-08-18 02:18:07 +000013// Target-independent interfaces
Akira Hatanakae2489122011-04-15 21:51:11 +000014//===----------------------------------------------------------------------===//
Bruno Cardoso Lopes35e43c42007-06-06 07:42:06 +000015
Evan Cheng977e7be2008-11-24 07:34:46 +000016include "llvm/Target/Target.td"
Bruno Cardoso Lopes35e43c42007-06-06 07:42:06 +000017
Akira Hatanakae2489122011-04-15 21:51:11 +000018//===----------------------------------------------------------------------===//
Bruno Cardoso Lopesc9c3f492008-07-05 19:05:21 +000019// Register File, Calling Conv, Instruction Descriptions
Akira Hatanakae2489122011-04-15 21:51:11 +000020//===----------------------------------------------------------------------===//
Bruno Cardoso Lopes35e43c42007-06-06 07:42:06 +000021
22include "MipsRegisterInfo.td"
Bruno Cardoso Lopesf3c55802007-08-18 02:18:07 +000023include "MipsSchedule.td"
Bruno Cardoso Lopes35e43c42007-06-06 07:42:06 +000024include "MipsInstrInfo.td"
Bruno Cardoso Lopesf3c55802007-08-18 02:18:07 +000025include "MipsCallingConv.td"
Bruno Cardoso Lopes35e43c42007-06-06 07:42:06 +000026
Jakob Stoklund Olesenb93331f2010-04-05 03:10:20 +000027def MipsInstrInfo : InstrInfo;
Bruno Cardoso Lopesf3c55802007-08-18 02:18:07 +000028
Akira Hatanakae2489122011-04-15 21:51:11 +000029//===----------------------------------------------------------------------===//
30// Mips Subtarget features //
31//===----------------------------------------------------------------------===//
Bruno Cardoso Lopes35e43c42007-06-06 07:42:06 +000032
Bruno Cardoso Lopesbcc21392008-07-09 05:32:22 +000033def FeatureGP64Bit : SubtargetFeature<"gp64", "IsGP64bit", "true",
Bruno Cardoso Lopesc9c3f492008-07-05 19:05:21 +000034 "General Purpose Registers are 64-bit wide.">;
Bruno Cardoso Lopesbcc21392008-07-09 05:32:22 +000035def FeatureFP64Bit : SubtargetFeature<"fp64", "IsFP64bit", "true",
Akira Hatanaka3048b022013-10-30 02:29:43 +000036 "Support 64-bit FP registers.">;
Bruno Cardoso Lopesbcc21392008-07-09 05:32:22 +000037def FeatureSingleFloat : SubtargetFeature<"single-float", "IsSingleFloat",
Akira Hatanakae2489122011-04-15 21:51:11 +000038 "true", "Only supports single precision float">;
Bruno Cardoso Lopesbcc21392008-07-09 05:32:22 +000039def FeatureO32 : SubtargetFeature<"o32", "MipsABI", "O32",
Bruno Cardoso Lopesc9c3f492008-07-05 19:05:21 +000040 "Enable o32 ABI">;
Akira Hatanaka2b372612011-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 Lopesbcc21392008-07-09 05:32:22 +000045def FeatureEABI : SubtargetFeature<"eabi", "MipsABI", "EABI",
Bruno Cardoso Lopesc9c3f492008-07-05 19:05:21 +000046 "Enable eabi ABI">;
Bruno Cardoso Lopes9c656fe2010-11-08 21:42:32 +000047def FeatureVFPU : SubtargetFeature<"vfpu", "HasVFPU",
Bruno Cardoso Lopesbcc21392008-07-09 05:32:22 +000048 "true", "Enable vector FPU instructions.">;
Bruno Cardoso Lopes9c656fe2010-11-08 21:42:32 +000049def FeatureSEInReg : SubtargetFeature<"seinreg", "HasSEInReg", "true",
Bruno Cardoso Lopesbcc21392008-07-09 05:32:22 +000050 "Enable 'signext in register' instructions.">;
Bruno Cardoso Lopes9c656fe2010-11-08 21:42:32 +000051def FeatureCondMov : SubtargetFeature<"condmov", "HasCondMov", "true",
Bruno Cardoso Lopesf714e252008-07-30 17:01:06 +000052 "Enable 'conditional move' instructions.">;
Bruno Cardoso Lopesf714e252008-07-30 17:01:06 +000053def FeatureSwap : SubtargetFeature<"swap", "HasSwap", "true",
54 "Enable 'byte/half swap' instructions.">;
55def FeatureBitCount : SubtargetFeature<"bitcount", "HasBitCount", "true",
56 "Enable 'count leading bits' instructions.">;
Akira Hatanaka3bc1beb2012-11-15 21:17:13 +000057def FeatureFPIdx : SubtargetFeature<"FPIdx", "HasFPIdx", "true",
58 "Enable 'FP indexed load/store' instructions.">;
Akira Hatanakae2489122011-04-15 21:51:11 +000059def FeatureMips32 : SubtargetFeature<"mips32", "MipsArchVersion", "Mips32",
60 "Mips32 ISA Support",
Bruno Cardoso Lopes67fc18a2010-11-10 02:13:22 +000061 [FeatureCondMov, FeatureBitCount]>;
Bruno Cardoso Lopes9c656fe2010-11-08 21:42:32 +000062def FeatureMips32r2 : SubtargetFeature<"mips32r2", "MipsArchVersion",
63 "Mips32r2", "Mips32r2 ISA Support",
Akira Hatanaka3bc1beb2012-11-15 21:17:13 +000064 [FeatureMips32, FeatureSEInReg, FeatureSwap,
65 FeatureFPIdx]>;
Daniel Sandersf7b32292014-04-03 12:13:36 +000066def FeatureMips4 : SubtargetFeature<"mips4", "MipsArchVersion",
67 "Mips4", "MIPS IV ISA Support",
68 [FeatureGP64Bit, FeatureFP64Bit,
69 FeatureCondMov]>;
Akira Hatanaka2b372612011-09-20 20:28:08 +000070def FeatureMips64 : SubtargetFeature<"mips64", "MipsArchVersion",
71 "Mips64", "Mips64 ISA Support",
Daniel Sandersf7b32292014-04-03 12:13:36 +000072 [FeatureMips4, FeatureMips32, FeatureFPIdx]>;
Akira Hatanaka2b372612011-09-20 20:28:08 +000073def FeatureMips64r2 : SubtargetFeature<"mips64r2", "MipsArchVersion",
74 "Mips64r2", "Mips64r2 ISA Support",
75 [FeatureMips64, FeatureMips32r2]>;
Bruno Cardoso Lopes35e43c42007-06-06 07:42:06 +000076
Akira Hatanaka0faaebf2012-05-16 22:19:56 +000077def FeatureMips16 : SubtargetFeature<"mips16", "InMips16Mode", "true",
78 "Mips16 mode">;
79
Akira Hatanaka65ce9312012-09-21 23:41:49 +000080def FeatureDSP : SubtargetFeature<"dsp", "HasDSP", "true", "Mips DSP ASE">;
81def FeatureDSPR2 : SubtargetFeature<"dspr2", "HasDSPR2", "true",
82 "Mips DSP-R2 ASE", [FeatureDSP]>;
83
Jack Carter3a2c2d42013-08-13 20:54:07 +000084def FeatureMSA : SubtargetFeature<"msa", "HasMSA", "true", "Mips MSA ASE">;
85
Jack Carter428a06c2013-02-05 09:30:03 +000086def FeatureMicroMips : SubtargetFeature<"micromips", "InMicroMipsMode", "true",
87 "microMips mode">;
88
Kai Nacke93fe5e82014-03-20 11:51:58 +000089def FeatureCnMips : SubtargetFeature<"cnmips", "HasCnMips",
90 "true", "Octeon cnMIPS Support",
91 [FeatureMips64r2]>;
92
Akira Hatanakae2489122011-04-15 21:51:11 +000093//===----------------------------------------------------------------------===//
Bruno Cardoso Lopes35e43c42007-06-06 07:42:06 +000094// Mips processors supported.
Akira Hatanakae2489122011-04-15 21:51:11 +000095//===----------------------------------------------------------------------===//
Bruno Cardoso Lopes35e43c42007-06-06 07:42:06 +000096
Bruno Cardoso Lopesc9c3f492008-07-05 19:05:21 +000097class Proc<string Name, list<SubtargetFeature> Features>
98 : Processor<Name, MipsGenericItineraries, Features>;
99
Daniel Sanders5a1449d2014-02-20 14:58:19 +0000100def : Proc<"mips32", [FeatureMips32, FeatureO32]>;
101def : Proc<"mips32r2", [FeatureMips32r2, FeatureO32]>;
Daniel Sandersf7b32292014-04-03 12:13:36 +0000102def : Proc<"mips4", [FeatureMips4, FeatureN64]>;
Daniel Sanders5a1449d2014-02-20 14:58:19 +0000103def : Proc<"mips64", [FeatureMips64, FeatureN64]>;
104def : Proc<"mips64r2", [FeatureMips64r2, FeatureN64]>;
105def : Proc<"mips16", [FeatureMips16, FeatureO32]>;
Kai Nacke93fe5e82014-03-20 11:51:58 +0000106def : Proc<"octeon", [FeatureMips64r2, FeatureN64, FeatureCnMips]>;
Bruno Cardoso Lopes9c656fe2010-11-08 21:42:32 +0000107
Akira Hatanaka7605630c2012-08-17 20:16:42 +0000108def MipsAsmParser : AsmParser {
109 let ShouldEmitMatchRegisterName = 0;
Vladimir Medicd3dade22013-08-01 09:25:27 +0000110 let MnemonicContainsDot = 1;
Bruno Cardoso Lopes35e43c42007-06-06 07:42:06 +0000111}
Akira Hatanaka9c6028f2011-07-07 23:56:50 +0000112
Akira Hatanaka7605630c2012-08-17 20:16:42 +0000113def MipsAsmParserVariant : AsmParserVariant {
114 int Variant = 0;
115
116 // Recognize hard coded registers.
117 string RegisterPrefix = "$";
118}
119
120def Mips : Target {
121 let InstructionSet = MipsInstrInfo;
122 let AssemblyParsers = [MipsAsmParser];
Akira Hatanaka7605630c2012-08-17 20:16:42 +0000123 let AssemblyParserVariants = [MipsAsmParserVariant];
124}