blob: d4d4995d6a7d8be5e914a135cffa2626d61d2f9f [file] [log] [blame]
Chris Lattner4c7b43b2005-10-14 23:37:35 +00001//===- PPC.td - Describe the PowerPC Target Machine --------*- tablegen -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file was developed by the LLVM research group and is distributed under
6// the University of Illinois Open Source 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 "../Target.td"
17
18//===----------------------------------------------------------------------===//
Jim Laskey5476b9b2005-10-22 08:04:24 +000019// PowerPC Subtarget features.
Jim Laskey53842142005-10-19 19:51:16 +000020//
21
Evan Cheng19c95502006-01-27 08:09:42 +000022def Feature64Bit : SubtargetFeature<"64bit","Is64Bit", "true",
Chris Lattner2e1f8232005-10-23 05:28:51 +000023 "Enable 64-bit instructions">;
Evan Cheng19c95502006-01-27 08:09:42 +000024def Feature64BitRegs : SubtargetFeature<"64bitregs","Has64BitRegs", "true",
Chris Lattneraa38be12005-10-23 22:23:45 +000025 "Enable 64-bit registers [beta]">;
Evan Cheng19c95502006-01-27 08:09:42 +000026def FeatureAltivec : SubtargetFeature<"altivec","HasAltivec", "true",
Chris Lattner2e1f8232005-10-23 05:28:51 +000027 "Enable Altivec instructions">;
Evan Cheng19c95502006-01-27 08:09:42 +000028def FeatureGPUL : SubtargetFeature<"gpul","IsGigaProcessor", "true",
Chris Lattner2e1f8232005-10-23 05:28:51 +000029 "Enable GPUL instructions">;
Evan Cheng19c95502006-01-27 08:09:42 +000030def FeatureFSqrt : SubtargetFeature<"fsqrt","HasFSQRT", "true",
Chris Lattner2e1f8232005-10-23 05:28:51 +000031 "Enable the fsqrt instruction">;
Chris Lattnerbf751e22006-02-28 07:08:22 +000032def FeatureSTFIWX : SubtargetFeature<"stfiwx","HasSTFIWX", "true",
33 "Enable the stfiwx instruction">;
Jim Laskey53842142005-10-19 19:51:16 +000034
35//===----------------------------------------------------------------------===//
Chris Lattnerc8d28892005-10-23 22:08:13 +000036// Register File Description
37//===----------------------------------------------------------------------===//
38
39include "PPCRegisterInfo.td"
40include "PPCSchedule.td"
41include "PPCInstrInfo.td"
42
43//===----------------------------------------------------------------------===//
44// PowerPC processors supported.
Jim Laskey53842142005-10-19 19:51:16 +000045//
46
Jim Laskey5476b9b2005-10-22 08:04:24 +000047def : Processor<"generic", G3Itineraries, []>;
Jim Laskey53842142005-10-19 19:51:16 +000048def : Processor<"601", G3Itineraries, []>;
49def : Processor<"602", G3Itineraries, []>;
50def : Processor<"603", G3Itineraries, []>;
Jim Laskeyf5fc2cb2005-10-21 19:05:19 +000051def : Processor<"603e", G3Itineraries, []>;
52def : Processor<"603ev", G3Itineraries, []>;
Jim Laskey53842142005-10-19 19:51:16 +000053def : Processor<"604", G3Itineraries, []>;
Jim Laskeyf5fc2cb2005-10-21 19:05:19 +000054def : Processor<"604e", G3Itineraries, []>;
55def : Processor<"620", G3Itineraries, []>;
Jim Laskey5476b9b2005-10-22 08:04:24 +000056def : Processor<"g3", G3Itineraries, []>;
Jim Laskeyf5fc2cb2005-10-21 19:05:19 +000057def : Processor<"7400", G4Itineraries, [FeatureAltivec]>;
Jim Laskey5476b9b2005-10-22 08:04:24 +000058def : Processor<"g4", G4Itineraries, [FeatureAltivec]>;
Jim Laskeyf5fc2cb2005-10-21 19:05:19 +000059def : Processor<"7450", G4PlusItineraries, [FeatureAltivec]>;
Jim Laskey5476b9b2005-10-22 08:04:24 +000060def : Processor<"g4+", G4PlusItineraries, [FeatureAltivec]>;
Jim Laskey53842142005-10-19 19:51:16 +000061def : Processor<"750", G3Itineraries, []>;
Jim Laskey53842142005-10-19 19:51:16 +000062def : Processor<"970", G5Itineraries,
Chris Lattnerbf751e22006-02-28 07:08:22 +000063 [FeatureAltivec, FeatureGPUL, FeatureFSqrt, FeatureSTFIWX,
Jim Laskey5476b9b2005-10-22 08:04:24 +000064 Feature64Bit /*, Feature64BitRegs */]>;
Jim Laskey53842142005-10-19 19:51:16 +000065def : Processor<"g5", G5Itineraries,
Chris Lattnerbf751e22006-02-28 07:08:22 +000066 [FeatureAltivec, FeatureGPUL, FeatureFSqrt, FeatureSTFIWX,
Jim Laskey5476b9b2005-10-22 08:04:24 +000067 Feature64Bit /*, Feature64BitRegs */]>;
Jim Laskey53842142005-10-19 19:51:16 +000068
69
Chris Lattner88d211f2006-03-12 09:13:49 +000070def PPCInstrInfo : InstrInfo {
71 // Define how we want to layout our TargetSpecific information field... This
72 // should be kept up-to-date with the fields in the PPCInstrInfo.h file.
73 let TSFlagsFields = ["PPC970_First",
74 "PPC970_Single",
75 "PPC970_Unit"];
76 let TSFlagsShifts = [0,
77 1,
78 2];
79
80 let isLittleEndianEncoding = 1;
81}
82
83
Chris Lattner4c7b43b2005-10-14 23:37:35 +000084def PPC : Target {
85 // Pointers on PPC are 32-bits in size.
86 let PointerType = i32;
87
Chris Lattner88d211f2006-03-12 09:13:49 +000088 // Information about the instructions.
89 let InstructionSet = PPCInstrInfo;
90
91
Chris Lattner4c7b43b2005-10-14 23:37:35 +000092 // According to the Mach-O Runtime ABI, these regs are nonvolatile across
93 // calls
94 let CalleeSavedRegisters = [R1, R13, R14, R15, R16, R17, R18, R19,
95 R20, R21, R22, R23, R24, R25, R26, R27, R28, R29, R30, R31, F14, F15,
96 F16, F17, F18, F19, F20, F21, F22, F23, F24, F25, F26, F27, F28, F29,
97 F30, F31, CR2, CR3, CR4, LR];
Chris Lattner4c7b43b2005-10-14 23:37:35 +000098}