First baby step towards ppc64 support. This adds a new -march=ppc64 backend
[oota-llvm.git] / lib / Target / PowerPC / PPCSubtarget.h
1 //=====-- PPCSubtarget.h - Define Subtarget for the PPC -------*- C++ -*--====//
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 //
10 // This file declares the PowerPC specific subclass of TargetSubtarget.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef POWERPCSUBTARGET_H
15 #define POWERPCSUBTARGET_H
16
17 #include "llvm/Target/TargetInstrItineraries.h"
18 #include "llvm/Target/TargetSubtarget.h"
19
20 #include <string>
21
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.
29   unsigned StackAlignment;
30   
31   /// Selected instruction itineraries (one entry per itinerary class.)
32   InstrItineraryData InstrItins;
33
34   /// Used by the ISel to turn in optimizations for POWER4-derived architectures
35   bool IsGigaProcessor;
36   bool Is64Bit;
37   bool Has64BitRegs;
38   bool HasAltivec;
39   bool HasFSQRT;
40   bool HasSTFIWX;
41   bool IsAIX;
42   bool IsDarwin;
43 public:
44   /// This constructor initializes the data members to match that
45   /// of the specified module.
46   ///
47   PPCSubtarget(const Module &M, const std::string &FS, bool is64Bit);
48   
49   /// ParseSubtargetFeatures - Parses features string setting specified 
50   /// subtarget options.  Definition of function is auto generated by tblgen.
51   void ParseSubtargetFeatures(const std::string &FS, const std::string &CPU);
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.
56   unsigned getStackAlignment() const { return StackAlignment; }
57   
58   /// getInstrItins - Return the instruction itineraies based on subtarget 
59   /// selection.
60   const InstrItineraryData getInstrItineraryData() const { return InstrItins; }
61   
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   }
66
67   bool hasFSQRT() const { return HasFSQRT; }
68   bool hasSTFIWX() const { return HasSTFIWX; }
69   bool has64BitRegs() const { return Has64BitRegs; }
70   bool hasAltivec() const { return HasAltivec; }
71   
72   bool isAIX() const { return IsAIX; }
73   bool isDarwin() const { return IsDarwin; }
74   bool is64Bit() const { return Is64Bit; }
75   bool isGigaProcessor() const { return IsGigaProcessor; }
76 };
77 } // End llvm namespace
78
79 #endif