blob: e971339a02e7699dc6ea134f8c75210d27a83f9b [file] [log] [blame]
Akira Hatanaka0bf3dfb2011-04-15 21:00: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 Hatanaka0bf3dfb2011-04-15 21:00:26 +00008//===---------------------------------------------------------------------===//
Bruno Cardoso Lopes6d32ca02007-08-18 02:18:07 +00009// This is the top level entry point for the Mips target.
Akira Hatanaka0bf3dfb2011-04-15 21:00:26 +000010//===---------------------------------------------------------------------===//
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000011
Akira Hatanaka0bf3dfb2011-04-15 21:00:26 +000012//===---------------------------------------------------------------------===//
Bruno Cardoso Lopes6d32ca02007-08-18 02:18:07 +000013// Target-independent interfaces
Akira Hatanaka0bf3dfb2011-04-15 21:00:26 +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 Hatanaka0bf3dfb2011-04-15 21:00:26 +000018//===---------------------------------------------------------------------===//
Bruno Cardoso Lopes225ca9c2008-07-05 19:05:21 +000019// Register File, Calling Conv, Instruction Descriptions
Akira Hatanaka0bf3dfb2011-04-15 21:00:26 +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 Hatanaka0bf3dfb2011-04-15 21:00:26 +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 Hatanaka0bf3dfb2011-04-15 21:00:26 +000038 "true",
39 "Only supports single precision float">;
Bruno Cardoso Lopes7728f7e2008-07-09 05:32:22 +000040def FeatureO32 : SubtargetFeature<"o32", "MipsABI", "O32",
Bruno Cardoso Lopes225ca9c2008-07-05 19:05:21 +000041 "Enable o32 ABI">;
Bruno Cardoso Lopes7728f7e2008-07-09 05:32:22 +000042def FeatureEABI : SubtargetFeature<"eabi", "MipsABI", "EABI",
Bruno Cardoso Lopes225ca9c2008-07-05 19:05:21 +000043 "Enable eabi ABI">;
Bruno Cardoso Lopes2c2304c2010-11-08 21:42:32 +000044def FeatureVFPU : SubtargetFeature<"vfpu", "HasVFPU",
Bruno Cardoso Lopes7728f7e2008-07-09 05:32:22 +000045 "true", "Enable vector FPU instructions.">;
Bruno Cardoso Lopes2c2304c2010-11-08 21:42:32 +000046def FeatureSEInReg : SubtargetFeature<"seinreg", "HasSEInReg", "true",
Bruno Cardoso Lopes7728f7e2008-07-09 05:32:22 +000047 "Enable 'signext in register' instructions.">;
Bruno Cardoso Lopes2c2304c2010-11-08 21:42:32 +000048def FeatureCondMov : SubtargetFeature<"condmov", "HasCondMov", "true",
Bruno Cardoso Lopesd3a680d2008-07-30 17:01:06 +000049 "Enable 'conditional move' instructions.">;
50def FeatureMulDivAdd : SubtargetFeature<"muldivadd", "HasMulDivAdd", "true",
51 "Enable 'multiply add/sub' instructions.">;
52def FeatureMinMax : SubtargetFeature<"minmax", "HasMinMax", "true",
53 "Enable 'min/max' instructions.">;
54def FeatureSwap : SubtargetFeature<"swap", "HasSwap", "true",
55 "Enable 'byte/half swap' instructions.">;
56def FeatureBitCount : SubtargetFeature<"bitcount", "HasBitCount", "true",
57 "Enable 'count leading bits' instructions.">;
Bruno Cardoso Lopes2c2304c2010-11-08 21:42:32 +000058def FeatureMips1 : SubtargetFeature<"mips1", "MipsArchVersion", "Mips1",
59 "Mips1 ISA Support">;
60def FeatureMips2 : SubtargetFeature<"mips2", "MipsArchVersion", "Mips2",
61 "Mips2 ISA Support">;
Akira Hatanaka0bf3dfb2011-04-15 21:00:26 +000062def FeatureMips32 : SubtargetFeature<"mips32", "MipsArchVersion",
63 "Mips32", "Mips32 ISA Support",
Bruno Cardoso Lopesc4bb67c2010-11-10 02:13:22 +000064 [FeatureCondMov, FeatureBitCount]>;
Bruno Cardoso Lopes2c2304c2010-11-08 21:42:32 +000065def FeatureMips32r2 : SubtargetFeature<"mips32r2", "MipsArchVersion",
66 "Mips32r2", "Mips32r2 ISA Support",
67 [FeatureMips32, FeatureSEInReg]>;
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000068
Akira Hatanaka0bf3dfb2011-04-15 21:00:26 +000069//===---------------------------------------------------------------------===//
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000070// Mips processors supported.
Akira Hatanaka0bf3dfb2011-04-15 21:00:26 +000071//===---------------------------------------------------------------------===//
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000072
Bruno Cardoso Lopes225ca9c2008-07-05 19:05:21 +000073class Proc<string Name, list<SubtargetFeature> Features>
74 : Processor<Name, MipsGenericItineraries, Features>;
75
Bruno Cardoso Lopesd3bdf192009-05-27 17:23:44 +000076def : Proc<"mips1", [FeatureMips1]>;
77def : Proc<"r2000", [FeatureMips1]>;
78def : Proc<"r3000", [FeatureMips1]>;
Bruno Cardoso Lopes225ca9c2008-07-05 19:05:21 +000079
80def : Proc<"mips2", [FeatureMips2]>;
81def : Proc<"r6000", [FeatureMips2]>;
82
Bruno Cardoso Lopes2c2304c2010-11-08 21:42:32 +000083def : Proc<"4ke", [FeatureMips32r2]>;
84
Chris Lattner7a2bdde2011-04-15 05:18:47 +000085// Allegrex is a 32bit subset of r4000, both for integer and fp registers,
Bruno Cardoso Lopes2c2304c2010-11-08 21:42:32 +000086// but much more similar to Mips2 than Mips3. It also contains some of
87// Mips32/Mips32r2 instructions and a custom vector fpu processor.
88def : Proc<"allegrex", [FeatureMips2, FeatureSingleFloat, FeatureEABI,
Bruno Cardoso Lopesd3a680d2008-07-30 17:01:06 +000089 FeatureVFPU, FeatureSEInReg, FeatureCondMov, FeatureMulDivAdd,
90 FeatureMinMax, FeatureSwap, FeatureBitCount]>;
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000091
92def Mips : Target {
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000093 let InstructionSet = MipsInstrInfo;
94}