Jia Liu | 31d157a | 2012-02-18 12:03:15 +0000 | [diff] [blame] | 1 | //===-- PPC.td - Describe the PowerPC Target Machine -------*- tablegen -*-===// |
| 2 | // |
Chris Lattner | 4c7b43b | 2005-10-14 23:37:35 +0000 | [diff] [blame] | 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Chris Lattner | 4ee451d | 2007-12-29 20:36:04 +0000 | [diff] [blame] | 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
Jia Liu | 31d157a | 2012-02-18 12:03:15 +0000 | [diff] [blame] | 7 | // |
Chris Lattner | 4c7b43b | 2005-10-14 23:37:35 +0000 | [diff] [blame] | 8 | //===----------------------------------------------------------------------===// |
| 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 Cheng | 027fdbe | 2008-11-24 07:34:46 +0000 | [diff] [blame] | 16 | include "llvm/Target/Target.td" |
Chris Lattner | 4c7b43b | 2005-10-14 23:37:35 +0000 | [diff] [blame] | 17 | |
| 18 | //===----------------------------------------------------------------------===// |
Jim Laskey | 5476b9b | 2005-10-22 08:04:24 +0000 | [diff] [blame] | 19 | // PowerPC Subtarget features. |
Jim Laskey | 5384214 | 2005-10-19 19:51:16 +0000 | [diff] [blame] | 20 | // |
| 21 | |
Jim Laskey | c35010d | 2006-12-12 20:57:08 +0000 | [diff] [blame] | 22 | //===----------------------------------------------------------------------===// |
| 23 | // CPU Directives // |
| 24 | //===----------------------------------------------------------------------===// |
| 25 | |
Hal Finkel | c6d08f1 | 2011-10-17 04:03:49 +0000 | [diff] [blame] | 26 | def Directive440 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_440", "">; |
Jim Laskey | c35010d | 2006-12-12 20:57:08 +0000 | [diff] [blame] | 27 | def Directive601 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_601", "">; |
| 28 | def Directive602 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_602", "">; |
| 29 | def Directive603 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_603", "">; |
| 30 | def Directive604 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_603", "">; |
| 31 | def Directive620 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_603", "">; |
| 32 | def Directive7400: SubtargetFeature<"", "DarwinDirective", "PPC::DIR_7400", "">; |
| 33 | def Directive750 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_750", "">; |
| 34 | def Directive970 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_970", "">; |
| 35 | def Directive32 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_32", "">; |
| 36 | def Directive64 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_64", "">; |
Hal Finkel | 4d989ac | 2012-04-01 19:22:40 +0000 | [diff] [blame] | 37 | def DirectiveA2 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_A2", "">; |
Hal Finkel | 621b77a | 2012-08-28 16:12:39 +0000 | [diff] [blame] | 38 | def DirectiveE500mc : SubtargetFeature<"", "DarwinDirective", |
| 39 | "PPC::DIR_E500mc", "">; |
| 40 | def DirectiveE5500 : SubtargetFeature<"", "DarwinDirective", |
| 41 | "PPC::DIR_E5500", "">; |
Bill Schmidt | cdc3b74 | 2013-02-01 22:59:51 +0000 | [diff] [blame] | 42 | def DirectivePwr3: SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR3", "">; |
| 43 | def DirectivePwr4: SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR4", "">; |
| 44 | def DirectivePwr5: SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR5", "">; |
| 45 | def DirectivePwr5x: SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR5X", "">; |
Hal Finkel | 622382f | 2012-06-11 15:43:08 +0000 | [diff] [blame] | 46 | def DirectivePwr6: SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR6", "">; |
Bill Schmidt | cdc3b74 | 2013-02-01 22:59:51 +0000 | [diff] [blame] | 47 | def DirectivePwr6x: SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR6X", "">; |
Hal Finkel | 622382f | 2012-06-11 15:43:08 +0000 | [diff] [blame] | 48 | def DirectivePwr7: SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR7", "">; |
Jim Laskey | c35010d | 2006-12-12 20:57:08 +0000 | [diff] [blame] | 49 | |
Chris Lattner | a7a5854 | 2006-06-16 17:34:12 +0000 | [diff] [blame] | 50 | def Feature64Bit : SubtargetFeature<"64bit","Has64BitSupport", "true", |
Chris Lattner | 2e1f823 | 2005-10-23 05:28:51 +0000 | [diff] [blame] | 51 | "Enable 64-bit instructions">; |
Chris Lattner | a7a5854 | 2006-06-16 17:34:12 +0000 | [diff] [blame] | 52 | def Feature64BitRegs : SubtargetFeature<"64bitregs","Use64BitRegs", "true", |
| 53 | "Enable 64-bit registers usage for ppc32 [beta]">; |
Evan Cheng | 19c9550 | 2006-01-27 08:09:42 +0000 | [diff] [blame] | 54 | def FeatureAltivec : SubtargetFeature<"altivec","HasAltivec", "true", |
Chris Lattner | 2e1f823 | 2005-10-23 05:28:51 +0000 | [diff] [blame] | 55 | "Enable Altivec instructions">; |
Hal Finkel | bd5cafd | 2012-06-11 19:57:01 +0000 | [diff] [blame] | 56 | def FeatureMFOCRF : SubtargetFeature<"mfocrf","HasMFOCRF", "true", |
| 57 | "Enable the MFOCRF instruction">; |
Evan Cheng | 19c9550 | 2006-01-27 08:09:42 +0000 | [diff] [blame] | 58 | def FeatureFSqrt : SubtargetFeature<"fsqrt","HasFSQRT", "true", |
Hal Finkel | 8ee53e2 | 2011-10-14 18:54:13 +0000 | [diff] [blame] | 59 | "Enable the fsqrt instruction">; |
Chris Lattner | bf751e2 | 2006-02-28 07:08:22 +0000 | [diff] [blame] | 60 | def FeatureSTFIWX : SubtargetFeature<"stfiwx","HasSTFIWX", "true", |
Hal Finkel | 8ee53e2 | 2011-10-14 18:54:13 +0000 | [diff] [blame] | 61 | "Enable the stfiwx instruction">; |
Hal Finkel | 8049ab1 | 2013-03-31 10:12:51 +0000 | [diff] [blame] | 62 | def FeatureLFIWAX : SubtargetFeature<"lfiwax","HasLFIWAX", "true", |
| 63 | "Enable the lfiwax instruction">; |
Hal Finkel | f5d5c43 | 2013-03-29 08:57:48 +0000 | [diff] [blame] | 64 | def FeatureFPRND : SubtargetFeature<"fprnd", "HasFPRND", "true", |
| 65 | "Enable the fri[mnpz] instructions">; |
Hal Finkel | 4647919 | 2013-04-01 17:52:07 +0000 | [diff] [blame^] | 66 | def FeatureFPCVT : SubtargetFeature<"fpcvt", "HasFPCVT", "true", |
| 67 | "Enable fc[ft]* (unsigned and single-precision) and lfiwzx instructions">; |
Hal Finkel | 009f7af | 2012-06-22 23:10:08 +0000 | [diff] [blame] | 68 | def FeatureISEL : SubtargetFeature<"isel","HasISEL", "true", |
| 69 | "Enable the isel instruction">; |
Hal Finkel | c53ab4d | 2013-03-28 13:29:47 +0000 | [diff] [blame] | 70 | def FeaturePOPCNTD : SubtargetFeature<"popcntd","HasPOPCNTD", "true", |
| 71 | "Enable the popcnt[dw] instructions">; |
Hal Finkel | efdd467 | 2013-03-28 19:25:55 +0000 | [diff] [blame] | 72 | def FeatureLDBRX : SubtargetFeature<"ldbrx","HasLDBRX", "true", |
| 73 | "Enable the ldbrx instruction">; |
Hal Finkel | c6d08f1 | 2011-10-17 04:03:49 +0000 | [diff] [blame] | 74 | def FeatureBookE : SubtargetFeature<"booke", "IsBookE", "true", |
| 75 | "Enable Book E instructions">; |
Hal Finkel | 5bb16fd | 2013-01-30 21:17:42 +0000 | [diff] [blame] | 76 | def FeatureQPX : SubtargetFeature<"qpx","HasQPX", "true", |
| 77 | "Enable QPX instructions">; |
Jim Laskey | 5384214 | 2005-10-19 19:51:16 +0000 | [diff] [blame] | 78 | |
Bill Schmidt | dbc86b9 | 2013-02-01 23:10:09 +0000 | [diff] [blame] | 79 | // Note: Future features to add when support is extended to more |
| 80 | // recent ISA levels: |
| 81 | // |
| 82 | // CMPB p6, p6x, p7 cmpb |
| 83 | // DFP p6, p6x, p7 decimal floating-point instructions |
Bill Schmidt | dbc86b9 | 2013-02-01 23:10:09 +0000 | [diff] [blame] | 84 | // FRE p5 through p7 fre (vs. fres, available since p3) |
| 85 | // FRSQRTES p5 through p7 frsqrtes (vs. frsqrte, available since p3) |
Bill Schmidt | dbc86b9 | 2013-02-01 23:10:09 +0000 | [diff] [blame] | 86 | // POPCNTB p5 through p7 popcntb and related instructions |
Bill Schmidt | dbc86b9 | 2013-02-01 23:10:09 +0000 | [diff] [blame] | 87 | // RECIP_PREC p6, p6x, p7 higher precision reciprocal estimates |
| 88 | // VSX p7 vector-scalar instruction set |
| 89 | |
Jim Laskey | 5384214 | 2005-10-19 19:51:16 +0000 | [diff] [blame] | 90 | //===----------------------------------------------------------------------===// |
Chris Lattner | c8d2889 | 2005-10-23 22:08:13 +0000 | [diff] [blame] | 91 | // Register File Description |
| 92 | //===----------------------------------------------------------------------===// |
| 93 | |
| 94 | include "PPCRegisterInfo.td" |
| 95 | include "PPCSchedule.td" |
| 96 | include "PPCInstrInfo.td" |
| 97 | |
| 98 | //===----------------------------------------------------------------------===// |
| 99 | // PowerPC processors supported. |
Jim Laskey | 5384214 | 2005-10-19 19:51:16 +0000 | [diff] [blame] | 100 | // |
| 101 | |
Jim Laskey | c35010d | 2006-12-12 20:57:08 +0000 | [diff] [blame] | 102 | def : Processor<"generic", G3Itineraries, [Directive32]>; |
Hal Finkel | 009f7af | 2012-06-22 23:10:08 +0000 | [diff] [blame] | 103 | def : Processor<"440", PPC440Itineraries, [Directive440, FeatureISEL, |
| 104 | FeatureBookE]>; |
| 105 | def : Processor<"450", PPC440Itineraries, [Directive440, FeatureISEL, |
| 106 | FeatureBookE]>; |
Jim Laskey | c35010d | 2006-12-12 20:57:08 +0000 | [diff] [blame] | 107 | def : Processor<"601", G3Itineraries, [Directive601]>; |
| 108 | def : Processor<"602", G3Itineraries, [Directive602]>; |
| 109 | def : Processor<"603", G3Itineraries, [Directive603]>; |
| 110 | def : Processor<"603e", G3Itineraries, [Directive603]>; |
| 111 | def : Processor<"603ev", G3Itineraries, [Directive603]>; |
| 112 | def : Processor<"604", G3Itineraries, [Directive604]>; |
| 113 | def : Processor<"604e", G3Itineraries, [Directive604]>; |
| 114 | def : Processor<"620", G3Itineraries, [Directive620]>; |
Hal Finkel | 6670c82 | 2012-06-12 16:39:23 +0000 | [diff] [blame] | 115 | def : Processor<"750", G4Itineraries, [Directive750]>; |
| 116 | def : Processor<"g3", G3Itineraries, [Directive750]>; |
Jim Laskey | c35010d | 2006-12-12 20:57:08 +0000 | [diff] [blame] | 117 | def : Processor<"7400", G4Itineraries, [Directive7400, FeatureAltivec]>; |
| 118 | def : Processor<"g4", G4Itineraries, [Directive7400, FeatureAltivec]>; |
| 119 | def : Processor<"7450", G4PlusItineraries, [Directive7400, FeatureAltivec]>; |
Hal Finkel | 6670c82 | 2012-06-12 16:39:23 +0000 | [diff] [blame] | 120 | def : Processor<"g4+", G4PlusItineraries, [Directive7400, FeatureAltivec]>; |
Jim Laskey | 5384214 | 2005-10-19 19:51:16 +0000 | [diff] [blame] | 121 | def : Processor<"970", G5Itineraries, |
Jim Laskey | c35010d | 2006-12-12 20:57:08 +0000 | [diff] [blame] | 122 | [Directive970, FeatureAltivec, |
Hal Finkel | bd5cafd | 2012-06-11 19:57:01 +0000 | [diff] [blame] | 123 | FeatureMFOCRF, FeatureFSqrt, FeatureSTFIWX, |
Jim Laskey | 5476b9b | 2005-10-22 08:04:24 +0000 | [diff] [blame] | 124 | Feature64Bit /*, Feature64BitRegs */]>; |
Jim Laskey | 5384214 | 2005-10-19 19:51:16 +0000 | [diff] [blame] | 125 | def : Processor<"g5", G5Itineraries, |
Jim Laskey | c35010d | 2006-12-12 20:57:08 +0000 | [diff] [blame] | 126 | [Directive970, FeatureAltivec, |
Hal Finkel | bd5cafd | 2012-06-11 19:57:01 +0000 | [diff] [blame] | 127 | FeatureMFOCRF, FeatureFSqrt, FeatureSTFIWX, |
Jim Laskey | c35010d | 2006-12-12 20:57:08 +0000 | [diff] [blame] | 128 | Feature64Bit /*, Feature64BitRegs */]>; |
Hal Finkel | 621b77a | 2012-08-28 16:12:39 +0000 | [diff] [blame] | 129 | def : ProcessorModel<"e500mc", PPCE500mcModel, |
| 130 | [DirectiveE500mc, FeatureMFOCRF, |
| 131 | FeatureSTFIWX, FeatureBookE, FeatureISEL]>; |
| 132 | def : ProcessorModel<"e5500", PPCE5500Model, |
| 133 | [DirectiveE5500, FeatureMFOCRF, Feature64Bit, |
| 134 | FeatureSTFIWX, FeatureBookE, FeatureISEL]>; |
Hal Finkel | efdd467 | 2013-03-28 19:25:55 +0000 | [diff] [blame] | 135 | def : Processor<"a2", PPCA2Itineraries, |
| 136 | [DirectiveA2, FeatureBookE, FeatureMFOCRF, |
Hal Finkel | 8049ab1 | 2013-03-31 10:12:51 +0000 | [diff] [blame] | 137 | FeatureFSqrt, FeatureSTFIWX, FeatureLFIWAX, |
Hal Finkel | 4647919 | 2013-04-01 17:52:07 +0000 | [diff] [blame^] | 138 | FeatureFPRND, FeatureFPCVT, FeatureISEL, |
| 139 | FeaturePOPCNTD, FeatureLDBRX, Feature64Bit |
| 140 | /*, Feature64BitRegs */]>; |
Hal Finkel | efdd467 | 2013-03-28 19:25:55 +0000 | [diff] [blame] | 141 | def : Processor<"a2q", PPCA2Itineraries, |
| 142 | [DirectiveA2, FeatureBookE, FeatureMFOCRF, |
Hal Finkel | 8049ab1 | 2013-03-31 10:12:51 +0000 | [diff] [blame] | 143 | FeatureFSqrt, FeatureSTFIWX, FeatureLFIWAX, |
Hal Finkel | 4647919 | 2013-04-01 17:52:07 +0000 | [diff] [blame^] | 144 | FeatureFPRND, FeatureFPCVT, FeatureISEL, |
| 145 | FeaturePOPCNTD, FeatureLDBRX, Feature64Bit |
| 146 | /*, Feature64BitRegs */, FeatureQPX]>; |
Bill Schmidt | cdc3b74 | 2013-02-01 22:59:51 +0000 | [diff] [blame] | 147 | def : Processor<"pwr3", G5Itineraries, |
| 148 | [DirectivePwr3, FeatureAltivec, FeatureMFOCRF, |
| 149 | FeatureSTFIWX, Feature64Bit]>; |
| 150 | def : Processor<"pwr4", G5Itineraries, |
| 151 | [DirectivePwr4, FeatureAltivec, FeatureMFOCRF, |
| 152 | FeatureFSqrt, FeatureSTFIWX, Feature64Bit]>; |
| 153 | def : Processor<"pwr5", G5Itineraries, |
| 154 | [DirectivePwr5, FeatureAltivec, FeatureMFOCRF, |
| 155 | FeatureFSqrt, FeatureSTFIWX, Feature64Bit]>; |
| 156 | def : Processor<"pwr5x", G5Itineraries, |
| 157 | [DirectivePwr5x, FeatureAltivec, FeatureMFOCRF, |
Hal Finkel | f5d5c43 | 2013-03-29 08:57:48 +0000 | [diff] [blame] | 158 | FeatureFSqrt, FeatureSTFIWX, FeatureFPRND, |
| 159 | Feature64Bit]>; |
Hal Finkel | 622382f | 2012-06-11 15:43:08 +0000 | [diff] [blame] | 160 | def : Processor<"pwr6", G5Itineraries, |
| 161 | [DirectivePwr6, FeatureAltivec, |
Hal Finkel | bd5cafd | 2012-06-11 19:57:01 +0000 | [diff] [blame] | 162 | FeatureMFOCRF, FeatureFSqrt, FeatureSTFIWX, |
Hal Finkel | 8049ab1 | 2013-03-31 10:12:51 +0000 | [diff] [blame] | 163 | FeatureLFIWAX, FeatureFPRND, Feature64Bit |
| 164 | /*, Feature64BitRegs */]>; |
Bill Schmidt | cdc3b74 | 2013-02-01 22:59:51 +0000 | [diff] [blame] | 165 | def : Processor<"pwr6x", G5Itineraries, |
| 166 | [DirectivePwr5x, FeatureAltivec, FeatureMFOCRF, |
Hal Finkel | 8049ab1 | 2013-03-31 10:12:51 +0000 | [diff] [blame] | 167 | FeatureFSqrt, FeatureSTFIWX, FeatureLFIWAX, |
| 168 | FeatureFPRND, Feature64Bit]>; |
Hal Finkel | 622382f | 2012-06-11 15:43:08 +0000 | [diff] [blame] | 169 | def : Processor<"pwr7", G5Itineraries, |
| 170 | [DirectivePwr7, FeatureAltivec, |
Hal Finkel | bd5cafd | 2012-06-11 19:57:01 +0000 | [diff] [blame] | 171 | FeatureMFOCRF, FeatureFSqrt, FeatureSTFIWX, |
Hal Finkel | 4647919 | 2013-04-01 17:52:07 +0000 | [diff] [blame^] | 172 | FeatureLFIWAX, FeatureFPRND, FeatureFPCVT, |
| 173 | FeatureISEL, FeaturePOPCNTD, FeatureLDBRX, |
| 174 | Feature64Bit /*, Feature64BitRegs */]>; |
Jim Laskey | c35010d | 2006-12-12 20:57:08 +0000 | [diff] [blame] | 175 | def : Processor<"ppc", G3Itineraries, [Directive32]>; |
| 176 | def : Processor<"ppc64", G5Itineraries, |
| 177 | [Directive64, FeatureAltivec, |
Hal Finkel | bd5cafd | 2012-06-11 19:57:01 +0000 | [diff] [blame] | 178 | FeatureMFOCRF, FeatureFSqrt, FeatureSTFIWX, |
Jim Laskey | 5476b9b | 2005-10-22 08:04:24 +0000 | [diff] [blame] | 179 | Feature64Bit /*, Feature64BitRegs */]>; |
Jim Laskey | 5384214 | 2005-10-19 19:51:16 +0000 | [diff] [blame] | 180 | |
| 181 | |
Chris Lattner | b9a7bea | 2007-03-06 00:59:59 +0000 | [diff] [blame] | 182 | //===----------------------------------------------------------------------===// |
| 183 | // Calling Conventions |
| 184 | //===----------------------------------------------------------------------===// |
| 185 | |
| 186 | include "PPCCallingConv.td" |
| 187 | |
Chris Lattner | 88d211f | 2006-03-12 09:13:49 +0000 | [diff] [blame] | 188 | def PPCInstrInfo : InstrInfo { |
Chris Lattner | 88d211f | 2006-03-12 09:13:49 +0000 | [diff] [blame] | 189 | let isLittleEndianEncoding = 1; |
| 190 | } |
| 191 | |
Chris Lattner | 84a04ad | 2010-11-15 03:53:53 +0000 | [diff] [blame] | 192 | def PPCAsmWriter : AsmWriter { |
| 193 | string AsmWriterClassName = "InstPrinter"; |
| 194 | bit isMCAsmWriter = 1; |
| 195 | } |
Chris Lattner | 88d211f | 2006-03-12 09:13:49 +0000 | [diff] [blame] | 196 | |
Chris Lattner | 4c7b43b | 2005-10-14 23:37:35 +0000 | [diff] [blame] | 197 | def PPC : Target { |
Chris Lattner | 88d211f | 2006-03-12 09:13:49 +0000 | [diff] [blame] | 198 | // Information about the instructions. |
| 199 | let InstructionSet = PPCInstrInfo; |
Chris Lattner | 84a04ad | 2010-11-15 03:53:53 +0000 | [diff] [blame] | 200 | |
| 201 | let AssemblyWriters = [PPCAsmWriter]; |
Chris Lattner | 4c7b43b | 2005-10-14 23:37:35 +0000 | [diff] [blame] | 202 | } |