Nate Begeman | 21e463b | 2005-10-16 05:39:50 +0000 | [diff] [blame] | 1 | //=====-- PPCSubtarget.h - Define Subtarget for the PPC -------*- C++ -*--====// |
Nate Begeman | 8c00f8c | 2005-08-04 07:12:09 +0000 | [diff] [blame] | 2 | // |
| 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 Lenharth | 68fd486 | 2005-09-29 21:11:57 +0000 | [diff] [blame] | 10 | // This file declares the PowerPC specific subclass of TargetSubtarget. |
Nate Begeman | 8c00f8c | 2005-08-04 07:12:09 +0000 | [diff] [blame] | 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #ifndef POWERPCSUBTARGET_H |
| 15 | #define POWERPCSUBTARGET_H |
| 16 | |
Jim Laskey | 6cee630 | 2005-11-01 20:06:59 +0000 | [diff] [blame^] | 17 | #include "llvm/Target/TargetInstrItineraries.h" |
Nate Begeman | 8c00f8c | 2005-08-04 07:12:09 +0000 | [diff] [blame] | 18 | #include "llvm/Target/TargetSubtarget.h" |
| 19 | |
Jim Laskey | b1e1180 | 2005-09-01 21:38:21 +0000 | [diff] [blame] | 20 | #include <string> |
| 21 | |
Nate Begeman | 8c00f8c | 2005-08-04 07:12:09 +0000 | [diff] [blame] | 22 | namespace llvm { |
| 23 | class Module; |
| 24 | |
| 25 | class PPCSubtarget : public TargetSubtarget { |
| 26 | protected: |
| 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 Lattner | 3c304a3 | 2005-08-05 22:05:03 +0000 | [diff] [blame] | 29 | unsigned StackAlignment; |
Jim Laskey | 6cee630 | 2005-11-01 20:06:59 +0000 | [diff] [blame^] | 30 | |
| 31 | /// Selected instruction itineraries (one entry per itinerary class.) |
| 32 | InstrItineraryData InstrItins; |
Nate Begeman | 8c00f8c | 2005-08-04 07:12:09 +0000 | [diff] [blame] | 33 | |
| 34 | /// Used by the ISel to turn in optimizations for POWER4-derived architectures |
Chris Lattner | 3c304a3 | 2005-08-05 22:05:03 +0000 | [diff] [blame] | 35 | bool IsGigaProcessor; |
Nate Begeman | d401dff | 2005-09-06 15:30:12 +0000 | [diff] [blame] | 36 | bool Is64Bit; |
Nate Begeman | 9d2b817 | 2005-10-18 00:56:42 +0000 | [diff] [blame] | 37 | bool Has64BitRegs; |
Jim Laskey | 581a8f7 | 2005-10-26 17:30:34 +0000 | [diff] [blame] | 38 | bool HasAltivec; |
Chris Lattner | 1e9de3e | 2005-09-02 18:33:05 +0000 | [diff] [blame] | 39 | bool HasFSQRT; |
Chris Lattner | 3c304a3 | 2005-08-05 22:05:03 +0000 | [diff] [blame] | 40 | bool IsAIX; |
| 41 | bool IsDarwin; |
Nate Begeman | 8c00f8c | 2005-08-04 07:12:09 +0000 | [diff] [blame] | 42 | public: |
| 43 | /// This constructor initializes the data members to match that |
| 44 | /// of the specified module. |
| 45 | /// |
Jim Laskey | b1e1180 | 2005-09-01 21:38:21 +0000 | [diff] [blame] | 46 | PPCSubtarget(const Module &M, const std::string &FS); |
Jim Laskey | 581a8f7 | 2005-10-26 17:30:34 +0000 | [diff] [blame] | 47 | |
| 48 | /// ParseSubtargetFeatures - Parses features string setting specified |
Jim Laskey | 2cbc207 | 2005-10-26 18:07:50 +0000 | [diff] [blame] | 49 | /// subtarget options. Definition of function is auto generated by tblgen. |
Jim Laskey | 581a8f7 | 2005-10-26 17:30:34 +0000 | [diff] [blame] | 50 | void ParseSubtargetFeatures(const std::string &FS, const std::string &CPU); |
Nate Begeman | 8c00f8c | 2005-08-04 07:12:09 +0000 | [diff] [blame] | 51 | |
| 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 Lattner | 3c304a3 | 2005-08-05 22:05:03 +0000 | [diff] [blame] | 55 | unsigned getStackAlignment() const { return StackAlignment; } |
Jim Laskey | 6cee630 | 2005-11-01 20:06:59 +0000 | [diff] [blame^] | 56 | |
| 57 | /// getInstrItins - Return the instruction itineraies based on subtarget |
| 58 | /// selection. |
| 59 | const InstrItineraryData getInstrItineraryData() const { return InstrItins; } |
| 60 | |
Nate Begeman | 8c00f8c | 2005-08-04 07:12:09 +0000 | [diff] [blame] | 61 | |
Chris Lattner | 1e9de3e | 2005-09-02 18:33:05 +0000 | [diff] [blame] | 62 | bool hasFSQRT() const { return HasFSQRT; } |
Jim Laskey | 581a8f7 | 2005-10-26 17:30:34 +0000 | [diff] [blame] | 63 | bool has64BitRegs() const { return Has64BitRegs; } |
| 64 | bool hasAltivec() const { return HasAltivec; } |
Chris Lattner | 1e9de3e | 2005-09-02 18:33:05 +0000 | [diff] [blame] | 65 | |
Chris Lattner | 3c304a3 | 2005-08-05 22:05:03 +0000 | [diff] [blame] | 66 | bool isAIX() const { return IsAIX; } |
| 67 | bool isDarwin() const { return IsDarwin; } |
Nate Begeman | d401dff | 2005-09-06 15:30:12 +0000 | [diff] [blame] | 68 | bool is64Bit() const { return Is64Bit; } |
Chris Lattner | 3c304a3 | 2005-08-05 22:05:03 +0000 | [diff] [blame] | 69 | bool isGigaProcessor() const { return IsGigaProcessor; } |
Nate Begeman | 8c00f8c | 2005-08-04 07:12:09 +0000 | [diff] [blame] | 70 | }; |
| 71 | } // End llvm namespace |
| 72 | |
| 73 | #endif |