2005-10-16 05:39:50 +00:00
|
|
|
//=====-- PPCSubtarget.h - Define Subtarget for the PPC -------*- C++ -*--====//
|
2005-08-04 07:12:09 +00:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file was developed by Nate Begeman and is distributed under the
|
|
|
|
// University of Illinois Open Source License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
2005-09-29 21:11:57 +00:00
|
|
|
// This file declares the PowerPC specific subclass of TargetSubtarget.
|
2005-08-04 07:12:09 +00:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef POWERPCSUBTARGET_H
|
|
|
|
#define POWERPCSUBTARGET_H
|
|
|
|
|
2005-11-01 20:06:59 +00:00
|
|
|
#include "llvm/Target/TargetInstrItineraries.h"
|
2005-08-04 07:12:09 +00:00
|
|
|
#include "llvm/Target/TargetSubtarget.h"
|
|
|
|
|
2005-09-01 21:38:21 +00:00
|
|
|
#include <string>
|
|
|
|
|
2005-08-04 07:12:09 +00:00
|
|
|
namespace llvm {
|
|
|
|
class Module;
|
|
|
|
|
|
|
|
class PPCSubtarget : public TargetSubtarget {
|
|
|
|
protected:
|
|
|
|
/// stackAlignment - The minimum alignment known to hold of the stack frame on
|
|
|
|
/// entry to the function and which must be maintained by every function.
|
2005-08-05 22:05:03 +00:00
|
|
|
unsigned StackAlignment;
|
2005-11-01 20:06:59 +00:00
|
|
|
|
|
|
|
/// Selected instruction itineraries (one entry per itinerary class.)
|
|
|
|
InstrItineraryData InstrItins;
|
2005-08-04 07:12:09 +00:00
|
|
|
|
|
|
|
/// Used by the ISel to turn in optimizations for POWER4-derived architectures
|
2005-08-05 22:05:03 +00:00
|
|
|
bool IsGigaProcessor;
|
2006-06-16 17:34:12 +00:00
|
|
|
bool Has64BitSupport;
|
|
|
|
bool Use64BitRegs;
|
2006-06-16 17:50:12 +00:00
|
|
|
bool IsPPC64;
|
2005-10-26 17:30:34 +00:00
|
|
|
bool HasAltivec;
|
2005-09-02 18:33:05 +00:00
|
|
|
bool HasFSQRT;
|
2006-02-28 07:08:22 +00:00
|
|
|
bool HasSTFIWX;
|
2005-08-05 22:05:03 +00:00
|
|
|
bool IsDarwin;
|
2005-08-04 07:12:09 +00:00
|
|
|
public:
|
|
|
|
/// This constructor initializes the data members to match that
|
|
|
|
/// of the specified module.
|
|
|
|
///
|
2006-06-16 01:37:27 +00:00
|
|
|
PPCSubtarget(const Module &M, const std::string &FS, bool is64Bit);
|
2005-10-26 17:30:34 +00:00
|
|
|
|
|
|
|
/// ParseSubtargetFeatures - Parses features string setting specified
|
2005-10-26 18:07:50 +00:00
|
|
|
/// subtarget options. Definition of function is auto generated by tblgen.
|
2005-10-26 17:30:34 +00:00
|
|
|
void ParseSubtargetFeatures(const std::string &FS, const std::string &CPU);
|
2005-08-04 07:12:09 +00:00
|
|
|
|
|
|
|
/// getStackAlignment - Returns the minimum alignment known to hold of the
|
|
|
|
/// stack frame on entry to the function and which must be maintained by every
|
|
|
|
/// function for this subtarget.
|
2005-08-05 22:05:03 +00:00
|
|
|
unsigned getStackAlignment() const { return StackAlignment; }
|
2005-11-01 20:06:59 +00:00
|
|
|
|
|
|
|
/// getInstrItins - Return the instruction itineraies based on subtarget
|
|
|
|
/// selection.
|
|
|
|
const InstrItineraryData getInstrItineraryData() const { return InstrItins; }
|
2006-06-16 17:50:12 +00:00
|
|
|
|
|
|
|
/// getTargetDataString - Return the pointer size and type alignment
|
|
|
|
/// properties of this subtarget.
|
2006-06-16 01:37:27 +00:00
|
|
|
const char *getTargetDataString() const {
|
2006-06-16 17:50:12 +00:00
|
|
|
return isPPC64() ? "E-p:64:64-d:32-l:32" : "E-p:32:32-d:32-l:32";
|
2006-06-16 01:37:27 +00:00
|
|
|
}
|
2005-08-04 07:12:09 +00:00
|
|
|
|
2006-06-16 17:50:12 +00:00
|
|
|
/// isPPC64 - Return true if we are generating code for 64-bit pointer mode.
|
|
|
|
///
|
|
|
|
bool isPPC64() const { return IsPPC64; }
|
|
|
|
|
|
|
|
/// has64BitSupport - Return true if the selected CPU supports 64-bit
|
|
|
|
/// instructions, regardless of whether we are in 32-bit or 64-bit mode.
|
|
|
|
bool has64BitSupport() const { return Has64BitSupport; }
|
|
|
|
|
|
|
|
/// use64BitRegs - Return true if in 64-bit mode or if we should use 64-bit
|
|
|
|
/// registers in 32-bit mode when possible. This can only true if
|
|
|
|
/// has64BitSupport() returns true.
|
|
|
|
bool use64BitRegs() const { return Use64BitRegs; }
|
|
|
|
|
|
|
|
|
|
|
|
// Specific obvious features.
|
2005-09-02 18:33:05 +00:00
|
|
|
bool hasFSQRT() const { return HasFSQRT; }
|
2006-02-28 07:08:22 +00:00
|
|
|
bool hasSTFIWX() const { return HasSTFIWX; }
|
2005-10-26 17:30:34 +00:00
|
|
|
bool hasAltivec() const { return HasAltivec; }
|
2006-06-16 17:50:12 +00:00
|
|
|
bool isGigaProcessor() const { return IsGigaProcessor; }
|
2005-09-02 18:33:05 +00:00
|
|
|
|
2005-08-05 22:05:03 +00:00
|
|
|
bool isDarwin() const { return IsDarwin; }
|
2005-08-04 07:12:09 +00:00
|
|
|
};
|
|
|
|
} // End llvm namespace
|
|
|
|
|
|
|
|
#endif
|