blob: 3f1454ce527cbc957be698537176e33026f7932c [file] [log] [blame]
Nate Begeman21e463b2005-10-16 05:39:50 +00001//=====-- PPCSubtarget.h - Define Subtarget for the PPC -------*- C++ -*--====//
Nate Begeman8c00f8c2005-08-04 07:12:09 +00002//
3// The LLVM Compiler Infrastructure
4//
5// This file was developed by Nate Begeman and is distributed under the
6// University of Illinois Open Source License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
Andrew Lenharth68fd4862005-09-29 21:11:57 +000010// This file declares the PowerPC specific subclass of TargetSubtarget.
Nate Begeman8c00f8c2005-08-04 07:12:09 +000011//
12//===----------------------------------------------------------------------===//
13
14#ifndef POWERPCSUBTARGET_H
15#define POWERPCSUBTARGET_H
16
Jim Laskey6cee6302005-11-01 20:06:59 +000017#include "llvm/Target/TargetInstrItineraries.h"
Nate Begeman8c00f8c2005-08-04 07:12:09 +000018#include "llvm/Target/TargetSubtarget.h"
19
Jim Laskeyb1e11802005-09-01 21:38:21 +000020#include <string>
21
Nate Begeman8c00f8c2005-08-04 07:12:09 +000022namespace llvm {
23class Module;
24
25class PPCSubtarget : public TargetSubtarget {
26protected:
27 /// stackAlignment - The minimum alignment known to hold of the stack frame on
28 /// entry to the function and which must be maintained by every function.
Chris Lattner3c304a32005-08-05 22:05:03 +000029 unsigned StackAlignment;
Jim Laskey6cee6302005-11-01 20:06:59 +000030
31 /// Selected instruction itineraries (one entry per itinerary class.)
32 InstrItineraryData InstrItins;
Nate Begeman8c00f8c2005-08-04 07:12:09 +000033
34 /// Used by the ISel to turn in optimizations for POWER4-derived architectures
Chris Lattner3c304a32005-08-05 22:05:03 +000035 bool IsGigaProcessor;
Nate Begemand401dff2005-09-06 15:30:12 +000036 bool Is64Bit;
Nate Begeman9d2b8172005-10-18 00:56:42 +000037 bool Has64BitRegs;
Jim Laskey581a8f72005-10-26 17:30:34 +000038 bool HasAltivec;
Chris Lattner1e9de3e2005-09-02 18:33:05 +000039 bool HasFSQRT;
Chris Lattner3c304a32005-08-05 22:05:03 +000040 bool IsAIX;
41 bool IsDarwin;
Nate Begeman8c00f8c2005-08-04 07:12:09 +000042public:
43 /// This constructor initializes the data members to match that
44 /// of the specified module.
45 ///
Jim Laskeyb1e11802005-09-01 21:38:21 +000046 PPCSubtarget(const Module &M, const std::string &FS);
Jim Laskey581a8f72005-10-26 17:30:34 +000047
48 /// ParseSubtargetFeatures - Parses features string setting specified
Jim Laskey2cbc2072005-10-26 18:07:50 +000049 /// subtarget options. Definition of function is auto generated by tblgen.
Jim Laskey581a8f72005-10-26 17:30:34 +000050 void ParseSubtargetFeatures(const std::string &FS, const std::string &CPU);
Nate Begeman8c00f8c2005-08-04 07:12:09 +000051
52 /// getStackAlignment - Returns the minimum alignment known to hold of the
53 /// stack frame on entry to the function and which must be maintained by every
54 /// function for this subtarget.
Chris Lattner3c304a32005-08-05 22:05:03 +000055 unsigned getStackAlignment() const { return StackAlignment; }
Jim Laskey6cee6302005-11-01 20:06:59 +000056
57 /// getInstrItins - Return the instruction itineraies based on subtarget
58 /// selection.
59 const InstrItineraryData getInstrItineraryData() const { return InstrItins; }
60
Nate Begeman8c00f8c2005-08-04 07:12:09 +000061
Chris Lattner1e9de3e2005-09-02 18:33:05 +000062 bool hasFSQRT() const { return HasFSQRT; }
Jim Laskey581a8f72005-10-26 17:30:34 +000063 bool has64BitRegs() const { return Has64BitRegs; }
64 bool hasAltivec() const { return HasAltivec; }
Chris Lattner1e9de3e2005-09-02 18:33:05 +000065
Chris Lattner3c304a32005-08-05 22:05:03 +000066 bool isAIX() const { return IsAIX; }
67 bool isDarwin() const { return IsDarwin; }
Nate Begemand401dff2005-09-06 15:30:12 +000068 bool is64Bit() const { return Is64Bit; }
Chris Lattner3c304a32005-08-05 22:05:03 +000069 bool isGigaProcessor() const { return IsGigaProcessor; }
Nate Begeman8c00f8c2005-08-04 07:12:09 +000070};
71} // End llvm namespace
72
73#endif