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; |
Chris Lattner | a7a5854 | 2006-06-16 17:34:12 +0000 | [diff] [blame^] | 36 | bool Has64BitSupport; |
| 37 | bool Use64BitRegs; |
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 | bf751e2 | 2006-02-28 07:08:22 +0000 | [diff] [blame] | 40 | bool HasSTFIWX; |
Chris Lattner | 3c304a3 | 2005-08-05 22:05:03 +0000 | [diff] [blame] | 41 | bool IsAIX; |
| 42 | bool IsDarwin; |
Nate Begeman | 8c00f8c | 2005-08-04 07:12:09 +0000 | [diff] [blame] | 43 | public: |
| 44 | /// This constructor initializes the data members to match that |
| 45 | /// of the specified module. |
| 46 | /// |
Chris Lattner | 94de9a8 | 2006-06-16 01:37:27 +0000 | [diff] [blame] | 47 | PPCSubtarget(const Module &M, const std::string &FS, bool is64Bit); |
Jim Laskey | 581a8f7 | 2005-10-26 17:30:34 +0000 | [diff] [blame] | 48 | |
| 49 | /// ParseSubtargetFeatures - Parses features string setting specified |
Jim Laskey | 2cbc207 | 2005-10-26 18:07:50 +0000 | [diff] [blame] | 50 | /// subtarget options. Definition of function is auto generated by tblgen. |
Jim Laskey | 581a8f7 | 2005-10-26 17:30:34 +0000 | [diff] [blame] | 51 | void ParseSubtargetFeatures(const std::string &FS, const std::string &CPU); |
Nate Begeman | 8c00f8c | 2005-08-04 07:12:09 +0000 | [diff] [blame] | 52 | |
| 53 | /// getStackAlignment - Returns the minimum alignment known to hold of the |
| 54 | /// stack frame on entry to the function and which must be maintained by every |
| 55 | /// function for this subtarget. |
Chris Lattner | 3c304a3 | 2005-08-05 22:05:03 +0000 | [diff] [blame] | 56 | unsigned getStackAlignment() const { return StackAlignment; } |
Jim Laskey | 6cee630 | 2005-11-01 20:06:59 +0000 | [diff] [blame] | 57 | |
| 58 | /// getInstrItins - Return the instruction itineraies based on subtarget |
| 59 | /// selection. |
| 60 | const InstrItineraryData getInstrItineraryData() const { return InstrItins; } |
| 61 | |
Chris Lattner | 94de9a8 | 2006-06-16 01:37:27 +0000 | [diff] [blame] | 62 | const char *getTargetDataString() const { |
| 63 | // FIXME: Make is64Bit be for the processor, not the target. |
| 64 | return true ? "E-p:32:32-d:32-l:32" : "E-p:64:64-d:32-l:32"; |
| 65 | } |
Nate Begeman | 8c00f8c | 2005-08-04 07:12:09 +0000 | [diff] [blame] | 66 | |
Chris Lattner | 1e9de3e | 2005-09-02 18:33:05 +0000 | [diff] [blame] | 67 | bool hasFSQRT() const { return HasFSQRT; } |
Chris Lattner | bf751e2 | 2006-02-28 07:08:22 +0000 | [diff] [blame] | 68 | bool hasSTFIWX() const { return HasSTFIWX; } |
Chris Lattner | a7a5854 | 2006-06-16 17:34:12 +0000 | [diff] [blame^] | 69 | bool use64BitRegs() const { return Use64BitRegs; } |
Jim Laskey | 581a8f7 | 2005-10-26 17:30:34 +0000 | [diff] [blame] | 70 | bool hasAltivec() const { return HasAltivec; } |
Chris Lattner | 1e9de3e | 2005-09-02 18:33:05 +0000 | [diff] [blame] | 71 | |
Chris Lattner | 3c304a3 | 2005-08-05 22:05:03 +0000 | [diff] [blame] | 72 | bool isAIX() const { return IsAIX; } |
| 73 | bool isDarwin() const { return IsDarwin; } |
Chris Lattner | a7a5854 | 2006-06-16 17:34:12 +0000 | [diff] [blame^] | 74 | bool has64BitSupport() const { return Has64BitSupport; } |
Chris Lattner | 3c304a3 | 2005-08-05 22:05:03 +0000 | [diff] [blame] | 75 | bool isGigaProcessor() const { return IsGigaProcessor; } |
Nate Begeman | 8c00f8c | 2005-08-04 07:12:09 +0000 | [diff] [blame] | 76 | }; |
| 77 | } // End llvm namespace |
| 78 | |
| 79 | #endif |