2012-02-18 12:03:15 +00:00
|
|
|
//===-- PTXSubtarget.h - Define Subtarget for the PTX -----------*- C++ -*-===//
|
2010-09-18 18:52:28 +00:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
2011-07-01 21:01:15 +00:00
|
|
|
// This file declares the PTX specific subclass of TargetSubtargetInfo.
|
2010-09-18 18:52:28 +00:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef PTX_SUBTARGET_H
|
|
|
|
#define PTX_SUBTARGET_H
|
|
|
|
|
2011-07-01 21:01:15 +00:00
|
|
|
#include "llvm/Target/TargetSubtargetInfo.h"
|
2010-09-18 18:52:28 +00:00
|
|
|
|
2011-07-01 20:45:01 +00:00
|
|
|
#define GET_SUBTARGETINFO_HEADER
|
2011-07-01 22:36:09 +00:00
|
|
|
#include "PTXGenSubtargetInfo.inc"
|
2011-07-01 20:45:01 +00:00
|
|
|
|
2010-09-18 18:52:28 +00:00
|
|
|
namespace llvm {
|
2011-07-07 07:07:08 +00:00
|
|
|
class StringRef;
|
|
|
|
|
2011-07-01 20:45:01 +00:00
|
|
|
class PTXSubtarget : public PTXGenSubtargetInfo {
|
2011-12-20 02:50:00 +00:00
|
|
|
virtual void anchor();
|
2011-06-23 18:10:03 +00:00
|
|
|
public:
|
2011-03-15 13:24:15 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Enumeration of Shader Models supported by the back-end.
|
|
|
|
*/
|
2011-06-24 16:27:49 +00:00
|
|
|
enum PTXTargetEnum {
|
|
|
|
PTX_COMPUTE_1_0, /*< Compute Compatibility 1.0 */
|
|
|
|
PTX_COMPUTE_1_1, /*< Compute Compatibility 1.1 */
|
|
|
|
PTX_COMPUTE_1_2, /*< Compute Compatibility 1.2 */
|
|
|
|
PTX_COMPUTE_1_3, /*< Compute Compatibility 1.3 */
|
|
|
|
PTX_COMPUTE_2_0, /*< Compute Compatibility 2.0 */
|
|
|
|
PTX_LAST_COMPUTE,
|
|
|
|
|
2011-03-15 13:24:15 +00:00
|
|
|
PTX_SM_1_0, /*< Shader Model 1.0 */
|
2011-06-24 16:27:49 +00:00
|
|
|
PTX_SM_1_1, /*< Shader Model 1.1 */
|
|
|
|
PTX_SM_1_2, /*< Shader Model 1.2 */
|
2011-03-15 13:24:15 +00:00
|
|
|
PTX_SM_1_3, /*< Shader Model 1.3 */
|
2011-06-24 16:27:49 +00:00
|
|
|
PTX_SM_2_0, /*< Shader Model 2.0 */
|
|
|
|
PTX_SM_2_1, /*< Shader Model 2.1 */
|
|
|
|
PTX_SM_2_2, /*< Shader Model 2.2 */
|
|
|
|
PTX_SM_2_3, /*< Shader Model 2.3 */
|
|
|
|
PTX_LAST_SM
|
2011-03-02 03:20:28 +00:00
|
|
|
};
|
|
|
|
|
2011-03-15 13:24:15 +00:00
|
|
|
/**
|
|
|
|
* Enumeration of PTX versions supported by the back-end.
|
|
|
|
*
|
|
|
|
* Currently, PTX 2.0 is the minimum supported version.
|
|
|
|
*/
|
2011-03-02 03:20:28 +00:00
|
|
|
enum PTXVersionEnum {
|
2011-03-15 13:24:15 +00:00
|
|
|
PTX_VERSION_2_0, /*< PTX Version 2.0 */
|
|
|
|
PTX_VERSION_2_1, /*< PTX Version 2.1 */
|
2011-05-06 11:40:36 +00:00
|
|
|
PTX_VERSION_2_2, /*< PTX Version 2.2 */
|
|
|
|
PTX_VERSION_2_3 /*< PTX Version 2.3 */
|
2011-03-02 03:20:28 +00:00
|
|
|
};
|
|
|
|
|
2011-06-23 18:10:03 +00:00
|
|
|
private:
|
|
|
|
|
2011-03-02 03:20:28 +00:00
|
|
|
/// Shader Model supported on the target GPU.
|
2011-06-24 16:27:49 +00:00
|
|
|
PTXTargetEnum PTXTarget;
|
2011-03-02 03:20:28 +00:00
|
|
|
|
|
|
|
/// PTX Language Version.
|
|
|
|
PTXVersionEnum PTXVersion;
|
|
|
|
|
|
|
|
// The native .f64 type is supported on the hardware.
|
|
|
|
bool SupportsDouble;
|
2011-06-16 15:17:11 +00:00
|
|
|
|
|
|
|
// Support the fused-multiply add (FMA) and multiply-add (MAD)
|
|
|
|
// instructions
|
2011-05-18 15:42:23 +00:00
|
|
|
bool SupportsFMA;
|
2011-06-16 15:17:11 +00:00
|
|
|
|
2011-03-02 07:36:48 +00:00
|
|
|
// Use .u64 instead of .u32 for addresses.
|
2011-04-20 15:37:17 +00:00
|
|
|
bool Is64Bit;
|
2011-03-02 07:36:48 +00:00
|
|
|
|
2010-09-18 18:52:28 +00:00
|
|
|
public:
|
2011-06-23 18:10:03 +00:00
|
|
|
|
2011-06-30 01:53:36 +00:00
|
|
|
PTXSubtarget(const std::string &TT, const std::string &CPU,
|
|
|
|
const std::string &FS, bool is64Bit);
|
2010-09-18 18:52:28 +00:00
|
|
|
|
2011-06-23 18:10:03 +00:00
|
|
|
// Target architecture accessors
|
2011-03-02 03:20:28 +00:00
|
|
|
std::string getTargetString() const;
|
|
|
|
|
|
|
|
std::string getPTXVersionString() const;
|
|
|
|
|
|
|
|
bool supportsDouble() const { return SupportsDouble; }
|
|
|
|
|
2011-04-20 15:37:17 +00:00
|
|
|
bool is64Bit() const { return Is64Bit; }
|
2011-03-02 07:36:48 +00:00
|
|
|
|
2011-05-18 15:42:23 +00:00
|
|
|
bool supportsFMA() const { return SupportsFMA; }
|
2011-06-16 15:17:11 +00:00
|
|
|
|
2011-03-10 16:57:18 +00:00
|
|
|
bool supportsPTX21() const { return PTXVersion >= PTX_VERSION_2_1; }
|
|
|
|
|
2011-03-15 13:24:15 +00:00
|
|
|
bool supportsPTX22() const { return PTXVersion >= PTX_VERSION_2_2; }
|
|
|
|
|
2011-05-10 12:32:11 +00:00
|
|
|
bool supportsPTX23() const { return PTXVersion >= PTX_VERSION_2_3; }
|
|
|
|
|
2011-06-24 16:27:49 +00:00
|
|
|
bool fdivNeedsRoundingMode() const {
|
|
|
|
return (PTXTarget >= PTX_SM_1_3 && PTXTarget < PTX_LAST_SM) ||
|
|
|
|
(PTXTarget >= PTX_COMPUTE_1_3 && PTXTarget < PTX_LAST_COMPUTE);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool fmadNeedsRoundingMode() const {
|
|
|
|
return (PTXTarget >= PTX_SM_1_3 && PTXTarget < PTX_LAST_SM) ||
|
|
|
|
(PTXTarget >= PTX_COMPUTE_1_3 && PTXTarget < PTX_LAST_COMPUTE);
|
|
|
|
}
|
2011-06-23 18:10:03 +00:00
|
|
|
|
2011-06-24 16:27:49 +00:00
|
|
|
bool useParamSpaceForDeviceArgs() const {
|
|
|
|
return (PTXTarget >= PTX_SM_2_0 && PTXTarget < PTX_LAST_SM) ||
|
|
|
|
(PTXTarget >= PTX_COMPUTE_2_0 && PTXTarget < PTX_LAST_COMPUTE);
|
|
|
|
}
|
2011-06-23 18:10:03 +00:00
|
|
|
|
2011-08-09 17:36:31 +00:00
|
|
|
bool callsAreHandled() const {
|
|
|
|
return (PTXTarget >= PTX_SM_2_0 && PTXTarget < PTX_LAST_SM) ||
|
|
|
|
(PTXTarget >= PTX_COMPUTE_2_0 && PTXTarget < PTX_LAST_COMPUTE);
|
|
|
|
}
|
|
|
|
|
2011-10-09 15:42:02 +00:00
|
|
|
bool emitPtrAttribute() const {
|
|
|
|
return PTXVersion >= PTX_VERSION_2_2;
|
|
|
|
}
|
|
|
|
|
2011-08-09 17:36:31 +00:00
|
|
|
void ParseSubtargetFeatures(StringRef CPU, StringRef FS);
|
2010-09-18 18:52:28 +00:00
|
|
|
}; // class PTXSubtarget
|
|
|
|
} // namespace llvm
|
|
|
|
|
|
|
|
#endif // PTX_SUBTARGET_H
|