2012-05-05 04:18:50 +08:00
|
|
|
//===-- NVPTX.h - Top-level interface for NVPTX representation --*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file contains the entry points for global functions defined in
|
|
|
|
// the LLVM NVPTX back-end.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2014-08-14 00:26:38 +08:00
|
|
|
#ifndef LLVM_LIB_TARGET_NVPTX_NVPTX_H
|
|
|
|
#define LLVM_LIB_TARGET_NVPTX_NVPTX_H
|
2012-05-05 04:18:50 +08:00
|
|
|
|
2012-12-04 15:12:27 +08:00
|
|
|
#include "MCTargetDesc/NVPTXBaseInfo.h"
|
2013-05-21 00:42:16 +08:00
|
|
|
#include "llvm/ADT/StringMap.h"
|
2013-01-02 19:36:10 +08:00
|
|
|
#include "llvm/IR/Module.h"
|
|
|
|
#include "llvm/IR/Value.h"
|
2012-05-05 04:18:50 +08:00
|
|
|
#include "llvm/Support/ErrorHandling.h"
|
|
|
|
#include "llvm/Target/TargetMachine.h"
|
2012-06-06 03:06:13 +08:00
|
|
|
#include <cassert>
|
|
|
|
#include <iosfwd>
|
2012-05-05 04:18:50 +08:00
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
class NVPTXTargetMachine;
|
|
|
|
class FunctionPass;
|
2013-05-31 20:14:49 +08:00
|
|
|
class MachineFunctionPass;
|
2012-05-05 04:18:50 +08:00
|
|
|
class formatted_raw_ostream;
|
|
|
|
|
|
|
|
namespace NVPTXCC {
|
|
|
|
enum CondCodes {
|
|
|
|
EQ,
|
|
|
|
NE,
|
|
|
|
LT,
|
|
|
|
LE,
|
|
|
|
GT,
|
|
|
|
GE
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2014-12-04 07:21:02 +08:00
|
|
|
FunctionPass *createNVPTXISelDag(NVPTXTargetMachine &TM,
|
|
|
|
llvm::CodeGenOpt::Level OptLevel);
|
2014-03-31 23:56:26 +08:00
|
|
|
ModulePass *createNVPTXAssignValidGlobalNamesPass();
|
2013-05-20 20:13:32 +08:00
|
|
|
ModulePass *createGenericToNVVMPass();
|
2016-05-27 01:02:56 +08:00
|
|
|
FunctionPass *createNVVMIntrRangePass(unsigned int SmVersion);
|
2018-08-04 02:05:24 +08:00
|
|
|
FunctionPass *createNVVMReflectPass(unsigned int SmVersion);
|
2013-05-31 20:14:49 +08:00
|
|
|
MachineFunctionPass *createNVPTXPrologEpilogPass();
|
2014-04-09 23:39:15 +08:00
|
|
|
MachineFunctionPass *createNVPTXReplaceImageHandlesPass();
|
|
|
|
FunctionPass *createNVPTXImageOptimizerPass();
|
2016-07-21 05:44:07 +08:00
|
|
|
FunctionPass *createNVPTXLowerArgsPass(const NVPTXTargetMachine *TM);
|
2015-06-18 06:31:02 +08:00
|
|
|
BasicBlockPass *createNVPTXLowerAllocaPass();
|
2015-06-25 04:20:16 +08:00
|
|
|
MachineFunctionPass *createNVPTXPeephole();
|
2012-05-05 04:18:50 +08:00
|
|
|
|
2016-10-10 07:00:34 +08:00
|
|
|
Target &getTheNVPTXTarget32();
|
|
|
|
Target &getTheNVPTXTarget64();
|
2012-05-05 04:18:50 +08:00
|
|
|
|
2013-03-30 22:29:21 +08:00
|
|
|
namespace NVPTX {
|
2012-05-05 04:18:50 +08:00
|
|
|
enum DrvInterface {
|
|
|
|
NVCL,
|
2013-06-22 02:51:49 +08:00
|
|
|
CUDA
|
2012-05-05 04:18:50 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
// A field inside TSFlags needs a shift and a mask. The usage is
|
|
|
|
// always as follows :
|
|
|
|
// ((TSFlags & fieldMask) >> fieldShift)
|
|
|
|
// The enum keeps the mask, the shift, and all valid values of the
|
|
|
|
// field in one place.
|
|
|
|
enum VecInstType {
|
|
|
|
VecInstTypeShift = 0,
|
|
|
|
VecInstTypeMask = 0xF,
|
|
|
|
|
|
|
|
VecNOP = 0,
|
|
|
|
VecLoad = 1,
|
|
|
|
VecStore = 2,
|
|
|
|
VecBuild = 3,
|
|
|
|
VecShuffle = 4,
|
|
|
|
VecExtract = 5,
|
|
|
|
VecInsert = 6,
|
|
|
|
VecDest = 7,
|
|
|
|
VecOther = 15
|
|
|
|
};
|
|
|
|
|
|
|
|
enum SimpleMove {
|
|
|
|
SimpleMoveMask = 0x10,
|
|
|
|
SimpleMoveShift = 4
|
|
|
|
};
|
|
|
|
enum LoadStore {
|
|
|
|
isLoadMask = 0x20,
|
|
|
|
isLoadShift = 5,
|
|
|
|
isStoreMask = 0x40,
|
|
|
|
isStoreShift = 6
|
|
|
|
};
|
|
|
|
|
|
|
|
namespace PTXLdStInstCode {
|
2013-03-30 22:29:21 +08:00
|
|
|
enum AddressSpace {
|
2012-05-05 04:18:50 +08:00
|
|
|
GENERIC = 0,
|
|
|
|
GLOBAL = 1,
|
|
|
|
CONSTANT = 2,
|
|
|
|
SHARED = 3,
|
|
|
|
PARAM = 4,
|
|
|
|
LOCAL = 5
|
|
|
|
};
|
|
|
|
enum FromType {
|
|
|
|
Unsigned = 0,
|
|
|
|
Signed,
|
2017-01-14 04:56:17 +08:00
|
|
|
Float,
|
|
|
|
Untyped
|
2012-05-05 04:18:50 +08:00
|
|
|
};
|
|
|
|
enum VecType {
|
|
|
|
Scalar = 1,
|
|
|
|
V2 = 2,
|
|
|
|
V4 = 4
|
|
|
|
};
|
2015-06-23 17:49:53 +08:00
|
|
|
}
|
2013-06-29 01:58:04 +08:00
|
|
|
|
|
|
|
/// PTXCvtMode - Conversion code enumeration
|
|
|
|
namespace PTXCvtMode {
|
|
|
|
enum CvtMode {
|
|
|
|
NONE = 0,
|
|
|
|
RNI,
|
|
|
|
RZI,
|
|
|
|
RMI,
|
|
|
|
RPI,
|
|
|
|
RN,
|
|
|
|
RZ,
|
|
|
|
RM,
|
|
|
|
RP,
|
|
|
|
|
|
|
|
BASE_MASK = 0x0F,
|
|
|
|
FTZ_FLAG = 0x10,
|
|
|
|
SAT_FLAG = 0x20
|
|
|
|
};
|
2015-06-23 17:49:53 +08:00
|
|
|
}
|
2013-06-29 01:58:04 +08:00
|
|
|
|
|
|
|
/// PTXCmpMode - Comparison mode enumeration
|
|
|
|
namespace PTXCmpMode {
|
|
|
|
enum CmpMode {
|
|
|
|
EQ = 0,
|
|
|
|
NE,
|
|
|
|
LT,
|
|
|
|
LE,
|
|
|
|
GT,
|
|
|
|
GE,
|
|
|
|
LO,
|
|
|
|
LS,
|
|
|
|
HI,
|
|
|
|
HS,
|
|
|
|
EQU,
|
|
|
|
NEU,
|
|
|
|
LTU,
|
|
|
|
LEU,
|
|
|
|
GTU,
|
|
|
|
GEU,
|
|
|
|
NUM,
|
|
|
|
// NAN is a MACRO
|
|
|
|
NotANumber,
|
|
|
|
|
|
|
|
BASE_MASK = 0xFF,
|
|
|
|
FTZ_FLAG = 0x100
|
|
|
|
};
|
2015-06-23 17:49:53 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} // end namespace llvm;
|
2012-05-05 04:18:50 +08:00
|
|
|
|
|
|
|
// Defines symbolic names for NVPTX registers. This defines a mapping from
|
|
|
|
// register name to register number.
|
|
|
|
#define GET_REGINFO_ENUM
|
|
|
|
#include "NVPTXGenRegisterInfo.inc"
|
|
|
|
|
|
|
|
// Defines symbolic names for the NVPTX instructions.
|
|
|
|
#define GET_INSTRINFO_ENUM
|
|
|
|
#include "NVPTXGenInstrInfo.inc"
|
|
|
|
|
|
|
|
#endif
|