1//===-- PPC.td - Describe the PowerPC Target Machine -------*- tablegen -*-===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 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// 16include "llvm/Target/Target.td" 17 18//===----------------------------------------------------------------------===// 19// PowerPC Subtarget features. 20// 21 22//===----------------------------------------------------------------------===// 23// CPU Directives // 24//===----------------------------------------------------------------------===// 25 26def Directive440 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_440", "">; 27def 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", "">; 37def DirectiveA2 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_A2", "">; 38def DirectiveE500mc : SubtargetFeature<"", "DarwinDirective", 39 "PPC::DIR_E500mc", "">; 40def DirectiveE5500 : SubtargetFeature<"", "DarwinDirective", 41 "PPC::DIR_E5500", "">; 42def DirectivePwr3: SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR3", "">; 43def DirectivePwr4: SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR4", "">; 44def DirectivePwr5: SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR5", "">; 45def DirectivePwr5x: SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR5X", "">; 46def DirectivePwr6: SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR6", "">; 47def DirectivePwr6x: SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR6X", "">; 48def DirectivePwr7: SubtargetFeature<"", "DarwinDirective", "PPC::DIR_PWR7", "">; 49 50def Feature64Bit : SubtargetFeature<"64bit","Has64BitSupport", "true", 51 "Enable 64-bit instructions">; 52def Feature64BitRegs : SubtargetFeature<"64bitregs","Use64BitRegs", "true", 53 "Enable 64-bit registers usage for ppc32 [beta]">; 54def FeatureAltivec : SubtargetFeature<"altivec","HasAltivec", "true", 55 "Enable Altivec instructions">; 56def FeatureMFOCRF : SubtargetFeature<"mfocrf","HasMFOCRF", "true", 57 "Enable the MFOCRF instruction">; 58def FeatureFSqrt : SubtargetFeature<"fsqrt","HasFSQRT", "true", 59 "Enable the fsqrt instruction">; 60def FeatureSTFIWX : SubtargetFeature<"stfiwx","HasSTFIWX", "true", 61 "Enable the stfiwx instruction">; 62def FeatureISEL : SubtargetFeature<"isel","HasISEL", "true", 63 "Enable the isel instruction">; 64def FeatureBookE : SubtargetFeature<"booke", "IsBookE", "true", 65 "Enable Book E instructions">; 66def FeatureQPX : SubtargetFeature<"qpx","HasQPX", "true", 67 "Enable QPX instructions">; 68 69// Note: Future features to add when support is extended to more 70// recent ISA levels: 71// 72// CMPB p6, p6x, p7 cmpb 73// DFP p6, p6x, p7 decimal floating-point instructions 74// FLT_CVT p7 fcfids, fcfidu, fcfidus, fcfiduz, fctiwuz 75// FPRND p5x, p6, p6x, p7 frim, frin, frip, friz 76// FRE p5 through p7 fre (vs. fres, available since p3) 77// FRSQRTES p5 through p7 frsqrtes (vs. frsqrte, available since p3) 78// LDBRX p7 load with byte reversal 79// LFIWAX p6, p6x, p7 lfiwax 80// LFIWZX p7 lfiwzx 81// POPCNTB p5 through p7 popcntb and related instructions 82// POPCNTD p7 popcntd and related instructions 83// RECIP_PREC p6, p6x, p7 higher precision reciprocal estimates 84// VSX p7 vector-scalar instruction set 85 86//===----------------------------------------------------------------------===// 87// Register File Description 88//===----------------------------------------------------------------------===// 89 90include "PPCRegisterInfo.td" 91include "PPCSchedule.td" 92include "PPCInstrInfo.td" 93 94//===----------------------------------------------------------------------===// 95// PowerPC processors supported. 96// 97 98def : Processor<"generic", G3Itineraries, [Directive32]>; 99def : Processor<"440", PPC440Itineraries, [Directive440, FeatureISEL, 100 FeatureBookE]>; 101def : Processor<"450", PPC440Itineraries, [Directive440, FeatureISEL, 102 FeatureBookE]>; 103def : Processor<"601", G3Itineraries, [Directive601]>; 104def : Processor<"602", G3Itineraries, [Directive602]>; 105def : Processor<"603", G3Itineraries, [Directive603]>; 106def : Processor<"603e", G3Itineraries, [Directive603]>; 107def : Processor<"603ev", G3Itineraries, [Directive603]>; 108def : Processor<"604", G3Itineraries, [Directive604]>; 109def : Processor<"604e", G3Itineraries, [Directive604]>; 110def : Processor<"620", G3Itineraries, [Directive620]>; 111def : Processor<"750", G4Itineraries, [Directive750]>; 112def : Processor<"g3", G3Itineraries, [Directive750]>; 113def : Processor<"7400", G4Itineraries, [Directive7400, FeatureAltivec]>; 114def : Processor<"g4", G4Itineraries, [Directive7400, FeatureAltivec]>; 115def : Processor<"7450", G4PlusItineraries, [Directive7400, FeatureAltivec]>; 116def : Processor<"g4+", G4PlusItineraries, [Directive7400, FeatureAltivec]>; 117def : Processor<"970", G5Itineraries, 118 [Directive970, FeatureAltivec, 119 FeatureMFOCRF, FeatureFSqrt, FeatureSTFIWX, 120 Feature64Bit /*, Feature64BitRegs */]>; 121def : Processor<"g5", G5Itineraries, 122 [Directive970, FeatureAltivec, 123 FeatureMFOCRF, FeatureFSqrt, FeatureSTFIWX, 124 Feature64Bit /*, Feature64BitRegs */]>; 125def : ProcessorModel<"e500mc", PPCE500mcModel, 126 [DirectiveE500mc, FeatureMFOCRF, 127 FeatureSTFIWX, FeatureBookE, FeatureISEL]>; 128def : ProcessorModel<"e5500", PPCE5500Model, 129 [DirectiveE5500, FeatureMFOCRF, Feature64Bit, 130 FeatureSTFIWX, FeatureBookE, FeatureISEL]>; 131def : Processor<"a2", PPCA2Itineraries, [DirectiveA2, FeatureBookE, 132 FeatureMFOCRF, FeatureFSqrt, 133 FeatureSTFIWX, FeatureISEL, 134 Feature64Bit 135 /*, Feature64BitRegs */]>; 136def : Processor<"a2q", PPCA2Itineraries, [DirectiveA2, FeatureBookE, 137 FeatureMFOCRF, FeatureFSqrt, 138 FeatureSTFIWX, FeatureISEL, 139 Feature64Bit /*, Feature64BitRegs */, 140 FeatureQPX]>; 141def : Processor<"pwr3", G5Itineraries, 142 [DirectivePwr3, FeatureAltivec, FeatureMFOCRF, 143 FeatureSTFIWX, Feature64Bit]>; 144def : Processor<"pwr4", G5Itineraries, 145 [DirectivePwr4, FeatureAltivec, FeatureMFOCRF, 146 FeatureFSqrt, FeatureSTFIWX, Feature64Bit]>; 147def : Processor<"pwr5", G5Itineraries, 148 [DirectivePwr5, FeatureAltivec, FeatureMFOCRF, 149 FeatureFSqrt, FeatureSTFIWX, Feature64Bit]>; 150def : Processor<"pwr5x", G5Itineraries, 151 [DirectivePwr5x, FeatureAltivec, FeatureMFOCRF, 152 FeatureFSqrt, FeatureSTFIWX, Feature64Bit]>; 153def : Processor<"pwr6", G5Itineraries, 154 [DirectivePwr6, FeatureAltivec, 155 FeatureMFOCRF, FeatureFSqrt, FeatureSTFIWX, 156 Feature64Bit /*, Feature64BitRegs */]>; 157def : Processor<"pwr6x", G5Itineraries, 158 [DirectivePwr5x, FeatureAltivec, FeatureMFOCRF, 159 FeatureFSqrt, FeatureSTFIWX, Feature64Bit]>; 160def : Processor<"pwr7", G5Itineraries, 161 [DirectivePwr7, FeatureAltivec, 162 FeatureMFOCRF, FeatureFSqrt, FeatureSTFIWX, 163 FeatureISEL, Feature64Bit /*, Feature64BitRegs */]>; 164def : Processor<"ppc", G3Itineraries, [Directive32]>; 165def : Processor<"ppc64", G5Itineraries, 166 [Directive64, FeatureAltivec, 167 FeatureMFOCRF, FeatureFSqrt, FeatureSTFIWX, 168 Feature64Bit /*, Feature64BitRegs */]>; 169 170 171//===----------------------------------------------------------------------===// 172// Calling Conventions 173//===----------------------------------------------------------------------===// 174 175include "PPCCallingConv.td" 176 177def PPCInstrInfo : InstrInfo { 178 let isLittleEndianEncoding = 1; 179} 180 181def PPCAsmWriter : AsmWriter { 182 string AsmWriterClassName = "InstPrinter"; 183 bit isMCAsmWriter = 1; 184} 185 186def PPC : Target { 187 // Information about the instructions. 188 let InstructionSet = PPCInstrInfo; 189 190 let AssemblyWriters = [PPCAsmWriter]; 191} 192