blob: 4ad5c54aa5298572341745b27f32743c64c5179d [file] [log] [blame]
Jia Liu31d157a2012-02-18 12:03:15 +00001//===-- PPC.td - Describe the PowerPC Target Machine -------*- tablegen -*-===//
2//
Chris Lattner4c7b43b2005-10-14 23:37:35 +00003// 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.
Jia Liu31d157a2012-02-18 12:03:15 +00007//
Chris Lattner4c7b43b2005-10-14 23:37:35 +00008//===----------------------------------------------------------------------===//
9//
10// This is the top level entry point for the PowerPC target.
11//
12//===----------------------------------------------------------------------===//
13
14// Get the target-independent interfaces which we are implementing.
15//
Evan Cheng027fdbe2008-11-24 07:34:46 +000016include "llvm/Target/Target.td"
Chris Lattner4c7b43b2005-10-14 23:37:35 +000017
18//===----------------------------------------------------------------------===//
Jim Laskey5476b9b2005-10-22 08:04:24 +000019// PowerPC Subtarget features.
Jim Laskey53842142005-10-19 19:51:16 +000020//
21
Jim Laskeyc35010d2006-12-12 20:57:08 +000022//===----------------------------------------------------------------------===//
23// CPU Directives //
24//===----------------------------------------------------------------------===//
25
Hal Finkelc6d08f12011-10-17 04:03:49 +000026def Directive440 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_440", "">;
Jim Laskeyc35010d2006-12-12 20:57:08 +000027def Directive601 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_601", "">;
28def Directive602 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_602", "">;
29def Directive603 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_603", "">;
30def Directive604 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_603", "">;
31def Directive620 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_603", "">;
32def Directive7400: SubtargetFeature<"", "DarwinDirective", "PPC::DIR_7400", "">;
33def Directive750 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_750", "">;
34def Directive970 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_970", "">;
35def Directive32 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_32", "">;
36def Directive64 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_64", "">;
Hal Finkel4d989ac2012-04-01 19:22:40 +000037def DirectiveA2 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_A2", "">;
Hal Finkel622382f2012-06-11 15:43:08 +000038def DirectivePwr6: SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR6", "">;
39def DirectivePwr7: SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR7", "">;
Jim Laskeyc35010d2006-12-12 20:57:08 +000040
Chris Lattnera7a58542006-06-16 17:34:12 +000041def Feature64Bit : SubtargetFeature<"64bit","Has64BitSupport", "true",
Chris Lattner2e1f8232005-10-23 05:28:51 +000042 "Enable 64-bit instructions">;
Chris Lattnera7a58542006-06-16 17:34:12 +000043def Feature64BitRegs : SubtargetFeature<"64bitregs","Use64BitRegs", "true",
44 "Enable 64-bit registers usage for ppc32 [beta]">;
Evan Cheng19c95502006-01-27 08:09:42 +000045def FeatureAltivec : SubtargetFeature<"altivec","HasAltivec", "true",
Chris Lattner2e1f8232005-10-23 05:28:51 +000046 "Enable Altivec instructions">;
Hal Finkelbd5cafd2012-06-11 19:57:01 +000047def FeatureMFOCRF : SubtargetFeature<"mfocrf","HasMFOCRF", "true",
48 "Enable the MFOCRF instruction">;
Evan Cheng19c95502006-01-27 08:09:42 +000049def FeatureFSqrt : SubtargetFeature<"fsqrt","HasFSQRT", "true",
Hal Finkel8ee53e22011-10-14 18:54:13 +000050 "Enable the fsqrt instruction">;
Chris Lattnerbf751e22006-02-28 07:08:22 +000051def FeatureSTFIWX : SubtargetFeature<"stfiwx","HasSTFIWX", "true",
Hal Finkel8ee53e22011-10-14 18:54:13 +000052 "Enable the stfiwx instruction">;
Hal Finkelc6d08f12011-10-17 04:03:49 +000053def FeatureBookE : SubtargetFeature<"booke", "IsBookE", "true",
54 "Enable Book E instructions">;
Jim Laskey53842142005-10-19 19:51:16 +000055
56//===----------------------------------------------------------------------===//
Chris Lattnerc8d28892005-10-23 22:08:13 +000057// Register File Description
58//===----------------------------------------------------------------------===//
59
60include "PPCRegisterInfo.td"
61include "PPCSchedule.td"
62include "PPCInstrInfo.td"
63
64//===----------------------------------------------------------------------===//
65// PowerPC processors supported.
Jim Laskey53842142005-10-19 19:51:16 +000066//
67
Jim Laskeyc35010d2006-12-12 20:57:08 +000068def : Processor<"generic", G3Itineraries, [Directive32]>;
Hal Finkelc6d08f12011-10-17 04:03:49 +000069def : Processor<"440", PPC440Itineraries, [Directive440, FeatureBookE]>;
70def : Processor<"450", PPC440Itineraries, [Directive440, FeatureBookE]>;
Jim Laskeyc35010d2006-12-12 20:57:08 +000071def : Processor<"601", G3Itineraries, [Directive601]>;
72def : Processor<"602", G3Itineraries, [Directive602]>;
73def : Processor<"603", G3Itineraries, [Directive603]>;
74def : Processor<"603e", G3Itineraries, [Directive603]>;
75def : Processor<"603ev", G3Itineraries, [Directive603]>;
76def : Processor<"604", G3Itineraries, [Directive604]>;
77def : Processor<"604e", G3Itineraries, [Directive604]>;
78def : Processor<"620", G3Itineraries, [Directive620]>;
79def : Processor<"g3", G3Itineraries, [Directive7400]>;
80def : Processor<"7400", G4Itineraries, [Directive7400, FeatureAltivec]>;
81def : Processor<"g4", G4Itineraries, [Directive7400, FeatureAltivec]>;
82def : Processor<"7450", G4PlusItineraries, [Directive7400, FeatureAltivec]>;
83def : Processor<"g4+", G4PlusItineraries, [Directive750, FeatureAltivec]>;
84def : Processor<"750", G4Itineraries, [Directive750, FeatureAltivec]>;
Jim Laskey53842142005-10-19 19:51:16 +000085def : Processor<"970", G5Itineraries,
Jim Laskeyc35010d2006-12-12 20:57:08 +000086 [Directive970, FeatureAltivec,
Hal Finkelbd5cafd2012-06-11 19:57:01 +000087 FeatureMFOCRF, FeatureFSqrt, FeatureSTFIWX,
Jim Laskey5476b9b2005-10-22 08:04:24 +000088 Feature64Bit /*, Feature64BitRegs */]>;
Jim Laskey53842142005-10-19 19:51:16 +000089def : Processor<"g5", G5Itineraries,
Jim Laskeyc35010d2006-12-12 20:57:08 +000090 [Directive970, FeatureAltivec,
Hal Finkelbd5cafd2012-06-11 19:57:01 +000091 FeatureMFOCRF, FeatureFSqrt, FeatureSTFIWX,
Jim Laskeyc35010d2006-12-12 20:57:08 +000092 Feature64Bit /*, Feature64BitRegs */]>;
Hal Finkel4d989ac2012-04-01 19:22:40 +000093def : Processor<"a2", PPCA2Itineraries, [DirectiveA2, FeatureBookE,
Hal Finkel5a53c6e2012-06-11 19:57:04 +000094 FeatureMFOCRF, FeatureFSqrt,
95 FeatureSTFIWX, Feature64Bit
Hal Finkelb66e9432012-04-01 21:20:14 +000096 /*, Feature64BitRegs */]>;
Hal Finkel622382f2012-06-11 15:43:08 +000097def : Processor<"pwr6", G5Itineraries,
98 [DirectivePwr6, FeatureAltivec,
Hal Finkelbd5cafd2012-06-11 19:57:01 +000099 FeatureMFOCRF, FeatureFSqrt, FeatureSTFIWX,
Hal Finkel622382f2012-06-11 15:43:08 +0000100 Feature64Bit /*, Feature64BitRegs */]>;
101def : Processor<"pwr7", G5Itineraries,
102 [DirectivePwr7, FeatureAltivec,
Hal Finkelbd5cafd2012-06-11 19:57:01 +0000103 FeatureMFOCRF, FeatureFSqrt, FeatureSTFIWX,
Hal Finkel622382f2012-06-11 15:43:08 +0000104 Feature64Bit /*, Feature64BitRegs */]>;
Jim Laskeyc35010d2006-12-12 20:57:08 +0000105def : Processor<"ppc", G3Itineraries, [Directive32]>;
106def : Processor<"ppc64", G5Itineraries,
107 [Directive64, FeatureAltivec,
Hal Finkelbd5cafd2012-06-11 19:57:01 +0000108 FeatureMFOCRF, FeatureFSqrt, FeatureSTFIWX,
Jim Laskey5476b9b2005-10-22 08:04:24 +0000109 Feature64Bit /*, Feature64BitRegs */]>;
Jim Laskey53842142005-10-19 19:51:16 +0000110
111
Chris Lattnerb9a7bea2007-03-06 00:59:59 +0000112//===----------------------------------------------------------------------===//
113// Calling Conventions
114//===----------------------------------------------------------------------===//
115
116include "PPCCallingConv.td"
117
Chris Lattner88d211f2006-03-12 09:13:49 +0000118def PPCInstrInfo : InstrInfo {
Chris Lattner88d211f2006-03-12 09:13:49 +0000119 let isLittleEndianEncoding = 1;
120}
121
Chris Lattner84a04ad2010-11-15 03:53:53 +0000122def PPCAsmWriter : AsmWriter {
123 string AsmWriterClassName = "InstPrinter";
124 bit isMCAsmWriter = 1;
125}
Chris Lattner88d211f2006-03-12 09:13:49 +0000126
Chris Lattner4c7b43b2005-10-14 23:37:35 +0000127def PPC : Target {
Chris Lattner88d211f2006-03-12 09:13:49 +0000128 // Information about the instructions.
129 let InstructionSet = PPCInstrInfo;
Chris Lattner84a04ad2010-11-15 03:53:53 +0000130
131 let AssemblyWriters = [PPCAsmWriter];
Chris Lattner4c7b43b2005-10-14 23:37:35 +0000132}