blob: e898a048c6cf189bbb6fcba47337f1b5b6a7443c [file] [log] [blame]
Nate Begeman6cca84e2005-10-16 05:39:50 +00001//=====-- PPCSubtarget.h - Define Subtarget for the PPC -------*- C++ -*--====//
Nate Begeman3bcfcd92005-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 Lenharthbae1f9d2005-09-29 21:11:57 +000010// This file declares the PowerPC specific subclass of TargetSubtarget.
Nate Begeman3bcfcd92005-08-04 07:12:09 +000011//
12//===----------------------------------------------------------------------===//
13
14#ifndef POWERPCSUBTARGET_H
15#define POWERPCSUBTARGET_H
16
Jim Laskey802748c2005-11-01 20:06:59 +000017#include "llvm/Target/TargetInstrItineraries.h"
Nate Begeman3bcfcd92005-08-04 07:12:09 +000018#include "llvm/Target/TargetSubtarget.h"
19
Jim Laskey19058c32005-09-01 21:38:21 +000020#include <string>
21
Nate Begeman3bcfcd92005-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 Lattner983a4152005-08-05 22:05:03 +000029 unsigned StackAlignment;
Jim Laskey802748c2005-11-01 20:06:59 +000030
31 /// Selected instruction itineraries (one entry per itinerary class.)
32 InstrItineraryData InstrItins;
Nate Begeman3bcfcd92005-08-04 07:12:09 +000033
34 /// Used by the ISel to turn in optimizations for POWER4-derived architectures
Chris Lattner983a4152005-08-05 22:05:03 +000035 bool IsGigaProcessor;
Chris Lattnera35f3062006-06-16 17:34:12 +000036 bool Has64BitSupport;
37 bool Use64BitRegs;
Jim Laskeya2b52352005-10-26 17:30:34 +000038 bool HasAltivec;
Chris Lattneraa3b1fc2005-09-02 18:33:05 +000039 bool HasFSQRT;
Chris Lattnerb9f35f02006-02-28 07:08:22 +000040 bool HasSTFIWX;
Chris Lattner983a4152005-08-05 22:05:03 +000041 bool IsAIX;
42 bool IsDarwin;
Nate Begeman3bcfcd92005-08-04 07:12:09 +000043public:
44 /// This constructor initializes the data members to match that
45 /// of the specified module.
46 ///
Chris Lattner0c4aa142006-06-16 01:37:27 +000047 PPCSubtarget(const Module &M, const std::string &FS, bool is64Bit);
Jim Laskeya2b52352005-10-26 17:30:34 +000048
49 /// ParseSubtargetFeatures - Parses features string setting specified
Jim Laskey75eab3c2005-10-26 18:07:50 +000050 /// subtarget options. Definition of function is auto generated by tblgen.
Jim Laskeya2b52352005-10-26 17:30:34 +000051 void ParseSubtargetFeatures(const std::string &FS, const std::string &CPU);
Nate Begeman3bcfcd92005-08-04 07:12:09 +000052
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 Lattner983a4152005-08-05 22:05:03 +000056 unsigned getStackAlignment() const { return StackAlignment; }
Jim Laskey802748c2005-11-01 20:06:59 +000057
58 /// getInstrItins - Return the instruction itineraies based on subtarget
59 /// selection.
60 const InstrItineraryData getInstrItineraryData() const { return InstrItins; }
61
Chris Lattner0c4aa142006-06-16 01:37:27 +000062 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 Begeman3bcfcd92005-08-04 07:12:09 +000066
Chris Lattneraa3b1fc2005-09-02 18:33:05 +000067 bool hasFSQRT() const { return HasFSQRT; }
Chris Lattnerb9f35f02006-02-28 07:08:22 +000068 bool hasSTFIWX() const { return HasSTFIWX; }
Chris Lattnera35f3062006-06-16 17:34:12 +000069 bool use64BitRegs() const { return Use64BitRegs; }
Jim Laskeya2b52352005-10-26 17:30:34 +000070 bool hasAltivec() const { return HasAltivec; }
Chris Lattneraa3b1fc2005-09-02 18:33:05 +000071
Chris Lattner983a4152005-08-05 22:05:03 +000072 bool isAIX() const { return IsAIX; }
73 bool isDarwin() const { return IsDarwin; }
Chris Lattnera35f3062006-06-16 17:34:12 +000074 bool has64BitSupport() const { return Has64BitSupport; }
Chris Lattner983a4152005-08-05 22:05:03 +000075 bool isGigaProcessor() const { return IsGigaProcessor; }
Nate Begeman3bcfcd92005-08-04 07:12:09 +000076};
77} // End llvm namespace
78
79#endif