GPUOcelot
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes

ir::PTXInstruction Class Reference

#include <PTXInstruction.h>

Inheritance diagram for ir::PTXInstruction:
Inheritance graph
[legend]
Collaboration diagram for ir::PTXInstruction:
Collaboration graph
[legend]

List of all members.

Public Types

enum  Level { CtaLevel, GlobalLevel, Level_Invalid }
enum  Opcode {
  Abs, Add, AddC, And,
  Atom, Bar, Bfe, Bfi,
  Bfind, Bra, Brev, Brkpt,
  Call, Clz, CNot, CopySign,
  Cos, Cvt, Cvta, Div,
  Ex2, Exit, Fma, Isspacep,
  Ld, Ldu, Lg2, Mad24,
  Mad, Max, Membar, Min,
  Mov, Mul24, Mul, Neg,
  Not, Or, Pmevent, Popc,
  Prefetch, Prefetchu, Prmt, Rcp,
  Red, Rem, Ret, Rsqrt,
  Sad, SelP, Set, SetP,
  Shl, Shr, Sin, SlCt,
  Sqrt, St, Sub, SubC,
  Suld, Sured, Sust, Suq,
  TestP, Tex, Tld4, Txq,
  Trap, Vabsdiff, Vadd, Vmad,
  Vmax, Vmin, Vset, Vshl,
  Vshr, Vsub, Vote, Xor,
  Reconverge, Phi, Nop, Invalid_Opcode
}
enum  Modifier {
  hi = 1, lo = 2, wide = 4, sat = 8,
  rn = 32, rz = 64, rm = 128, rp = 256,
  approx = 512, ftz = 1024, full = 2048, Modifier_invalid = 0
}
enum  CarryFlag { None = 0, CC = 1 }
enum  Volatility { Nonvolatile = 0, Volatile }
enum  AddressSpace {
  AddressSpace_Invalid = 0, Const, Global, Local,
  Param, Shared, Texture, Generic
}
enum  AtomicOperation {
  AtomicAnd, AtomicOr, AtomicXor, AtomicCas,
  AtomicExch, AtomicAdd, AtomicInc, AtomicDec,
  AtomicMin, AtomicMax, AtomicOperation_Invalid
}
enum  BarrierOperation { BarSync, BarArrive, BarReduction, BarrierOperation_invalid }
enum  ReductionOperation {
  ReductionAnd, ReductionXor, ReductionOr, ReductionAdd,
  ReductionInc, ReductionDec, ReductionMin, ReductionMax,
  ReductionPopc, ReductionOperation_Invalid
}
enum  CacheOperation {
  Ca, Cg, Cs, Cv,
  Wb, Wt, CacheOperation_Invalid
}
enum  ClampOperation {
  TrapOOB, Clamp, Zero, Mirror,
  ClampOperation_Invalid
}
enum  ColorComponent {
  red, green, blue, alpha,
  ColorComponent_Invalid
}
enum  CmpOp {
  Eq, Ne, Lt, Le,
  Gt, Ge, Lo, Ls,
  Hi, Hs, Equ, Neu,
  Ltu, Leu, Gtu, Geu,
  Num, Nan, CmpOp_Invalid
}
enum  PermuteMode {
  DefaultPermute, ForwardFourExtract, BackwardFourExtract, ReplicateEight,
  EdgeClampLeft, EdgeClampRight, ReplicateSixteen
}
enum  FloatingPointMode {
  Finite, Infinite, Number, NotANumber,
  Normal, SubNormal, FloatingPointMode_Invalid
}
enum  FormatMode { Unformatted, Formatted, FormatMode_Invalid }
enum  BoolOp {
  BoolAnd, BoolOr, BoolXor, BoolNop,
  BoolOp_Invalid
}
enum  Geometry { _1d = 1, _2d = 2, _3d = 3, Geometry_Invalid }
enum  SurfaceQuery {
  Width, Height, Depth, ChannelDataType,
  ChannelOrder, NormalizedCoordinates, SamplerFilterMode, SamplerAddrMode0,
  SamplerAddrMode1, SamplerAddrMode2, SurfaceQuery_Invalid
}
enum  VoteMode {
  All, Any, Uni, Ballot,
  VoteMode_Invalid
}
typedef PTXOperand::Vec Vec

Public Member Functions

 PTXInstruction (Opcode op=Nop, const PTXOperand &d=PTXOperand(), const PTXOperand &a=PTXOperand(), const PTXOperand &b=PTXOperand(), const PTXOperand &c=PTXOperand())
 ~PTXInstruction ()
bool operator== (const PTXInstruction &) const
std::string valid () const
std::string guard () const
std::string toString () const
Instructionclone (bool copy=true) const
 Clone the instruction.
bool isBranch () const
 Is the instruction a branch.
bool mayHaveAddressableOperand () const
 Does the instruction accept an address as an operand.
bool hasSideEffects () const
 Can the instruction affect state other than destinations?

Static Public Member Functions

static std::string toString (Level)
static std::string toString (PermuteMode)
static std::string toString (FloatingPointMode)
static std::string toString (Vec)
static std::string toString (AddressSpace)
static std::string toString (AtomicOperation)
static std::string toString (BarrierOperation)
static std::string toString (ReductionOperation)
static std::string toString (SurfaceQuery)
static std::string toString (FormatMode)
static std::string toString (ClampOperation)
static std::string toString (CmpOp)
static std::string toString (BoolOp)
static std::string roundingMode (Modifier)
static std::string toString (Modifier)
static std::string toString (Geometry)
static std::string modifierString (unsigned int, CarryFlag=None)
static std::string toString (VoteMode)
static std::string toString (ColorComponent)
static std::string toString (Opcode)
static bool isPt (const PTXOperand &)

Public Attributes

Opcode opcode
PTXOperand::DataType type
unsigned int modifier
union {
   CmpOp   comparisonOperator
   AddressSpace   addressSpace
   Level   level
   bool   shiftAmount
   PermuteMode   permuteMode
   bool   tailCall
   SurfaceQuery   surfaceQuery
   FormatMode   formatMode
   BarrierOperation   barrierOperation
   ColorComponent   colorComponent
}; 
PTXOperand pg
PTXOperand pq
Vec vec
union {
   AtomicOperation   atomicOperation
   ReductionOperation   reductionOperation
   VoteMode   vote
   FloatingPointMode   floatingPointMode
   bool   uni
   BoolOp   booleanOperator
   Volatility   volatility
   bool   divideFull
   bool   toAddrSpace
   PTXOperand::RegisterType   cc
   CacheOperation   cacheOperation
}; 
Geometry geometry
union {
   CarryFlag   carry
   ClampOperation   clamp
}; 
PTXOperand d
PTXOperand a
PTXOperand b
PTXOperand c
union {
   int   reconvergeInstruction
 Index of post dominator instruction at which possibly divergent branches reconverge.
   bool   needsReconvergenceCheck
 If this is a branch, is a check for re-convergence with threads waiting at the target necessary.
}; 
union {
   int   branchTargetInstruction
 Branch target instruction index.
   int   reentryPoint
 Context switch reentry point.
   bool   isArgument
 Is this a kernel argument in the parameter space?
}; 
unsigned int statementIndex
 The index of the statement that this instruction was created from.
unsigned int pc
 The program counter of the instruction.
std::string metadata
 Meta-data attached to the instruction.

Member Typedef Documentation

Vector operation


Member Enumeration Documentation

Enumerator:
AddressSpace_Invalid 
Const 
Global 
Local 
Param 
Shared 
Texture 
Generic 
Enumerator:
AtomicAnd 
AtomicOr 
AtomicXor 
AtomicCas 
AtomicExch 
AtomicAdd 
AtomicInc 
AtomicDec 
AtomicMin 
AtomicMax 
AtomicOperation_Invalid 
Enumerator:
BarSync 
BarArrive 
BarReduction 
BarrierOperation_invalid 

boolean operator

Enumerator:
BoolAnd 
BoolOr 
BoolXor 
BoolNop 
BoolOp_Invalid 
Enumerator:
Ca 
Cg 
Cs 
Cv 
Wb 
Wt 
CacheOperation_Invalid 
Enumerator:
None 
CC 
Enumerator:
TrapOOB 
Clamp 
Zero 
Mirror 
ClampOperation_Invalid 

comparison operator

Enumerator:
Eq 
Ne 
Lt 
Le 
Gt 
Ge 
Lo 
Ls 
Hi 
Hs 
Equ 
Neu 
Ltu 
Leu 
Gtu 
Geu 
Num 
Nan 
CmpOp_Invalid 
Enumerator:
red 
green 
blue 
alpha 
ColorComponent_Invalid 
Enumerator:
Finite 
Infinite 
Number 
NotANumber 
Normal 
SubNormal 
FloatingPointMode_Invalid 
Enumerator:
Unformatted 
Formatted 
FormatMode_Invalid 

geometry for textures

Enumerator:
_1d 
_2d 
_3d 
Geometry_Invalid 

Hierarchy Level

Enumerator:
CtaLevel 
GlobalLevel 
Level_Invalid 

Modifiers for integer and floating-point instructions. The FP rounding-modes are mutually exclusive but compatible with sat.

Enumerator:
hi 
lo 
wide 
sat 
rn 
rz 
rm 
rp 
approx 
ftz 
full 
Modifier_invalid 

List of opcodes for PTX instructions

Enumerator:
Abs 
Add 
AddC 
And 
Atom 
Bar 
Bfe 
Bfi 
Bfind 
Bra 
Brev 
Brkpt 
Call 
Clz 
CNot 
CopySign 
Cos 
Cvt 
Cvta 
Div 
Ex2 
Exit 
Fma 
Isspacep 
Ld 
Ldu 
Lg2 
Mad24 
Mad 
Max 
Membar 
Min 
Mov 
Mul24 
Mul 
Neg 
Not 
Or 
Pmevent 
Popc 
Prefetch 
Prefetchu 
Prmt 
Rcp 
Red 
Rem 
Ret 
Rsqrt 
Sad 
SelP 
Set 
SetP 
Shl 
Shr 
Sin 
SlCt 
Sqrt 
St 
Sub 
SubC 
Suld 
Sured 
Sust 
Suq 
TestP 
Tex 
Tld4 
Txq 
Trap 
Vabsdiff 
Vadd 
Vmad 
Vmax 
Vmin 
Vset 
Vshl 
Vshr 
Vsub 
Vote 
Xor 
Reconverge 
Phi 
Nop 
Invalid_Opcode 
Enumerator:
DefaultPermute 
ForwardFourExtract 
BackwardFourExtract 
ReplicateEight 
EdgeClampLeft 
EdgeClampRight 
ReplicateSixteen 
Enumerator:
ReductionAnd 
ReductionXor 
ReductionOr 
ReductionAdd 
ReductionInc 
ReductionDec 
ReductionMin 
ReductionMax 
ReductionPopc 
ReductionOperation_Invalid 
Enumerator:
Width 
Height 
Depth 
ChannelDataType 
ChannelOrder 
NormalizedCoordinates 
SamplerFilterMode 
SamplerAddrMode0 
SamplerAddrMode1 
SamplerAddrMode2 
SurfaceQuery_Invalid 
Enumerator:
Nonvolatile 
Volatile 
Enumerator:
All 
Any 
Uni 
Ballot 
VoteMode_Invalid 

Constructor & Destructor Documentation

ir::PTXInstruction::PTXInstruction ( Opcode  op = Nop,
const PTXOperand d = PTXOperand(),
const PTXOperand a = PTXOperand(),
const PTXOperand b = PTXOperand(),
const PTXOperand c = PTXOperand() 
)
ir::PTXInstruction::~PTXInstruction ( )

Member Function Documentation

ir::Instruction * ir::PTXInstruction::clone ( bool  copy = true) const [virtual]

Clone the instruction.

Implements ir::Instruction.

std::string ir::PTXInstruction::guard ( ) const

Returns the guard predicate representation for the instruction

bool ir::PTXInstruction::hasSideEffects ( ) const

Can the instruction affect state other than destinations?

bool ir::PTXInstruction::isBranch ( ) const

Is the instruction a branch.

bool ir::PTXInstruction::isPt ( const PTXOperand op) [static]
bool ir::PTXInstruction::mayHaveAddressableOperand ( ) const

Does the instruction accept an address as an operand.

std::string ir::PTXInstruction::modifierString ( unsigned int  modifier,
CarryFlag  carry = None 
) [static]
bool ir::PTXInstruction::operator== ( const PTXInstruction i) const
std::string ir::PTXInstruction::roundingMode ( Modifier  modifier) [static]
std::string ir::PTXInstruction::toString ( FormatMode  mode) [static]
std::string ir::PTXInstruction::toString ( ClampOperation  clamp) [static]
std::string ir::PTXInstruction::toString ( ColorComponent  color) [static]
std::string ir::PTXInstruction::toString ( VoteMode  mode) [static]
std::string ir::PTXInstruction::toString ( ReductionOperation  operation) [static]
std::string ir::PTXInstruction::toString ( PermuteMode  m) [static]
std::string ir::PTXInstruction::toString ( Modifier  modifier) [static]
std::string ir::PTXInstruction::toString ( FloatingPointMode  m) [static]
std::string ir::PTXInstruction::toString ( BarrierOperation  operation) [static]
std::string ir::PTXInstruction::toString ( AtomicOperation  operation) [static]
std::string ir::PTXInstruction::toString ( CmpOp  operation) [static]
std::string ir::PTXInstruction::toString ( Opcode  opcode) [static]
std::string ir::PTXInstruction::toString ( SurfaceQuery  query) [static]
std::string ir::PTXInstruction::toString ( Vec  v) [static]
std::string ir::PTXInstruction::toString ( BoolOp  operation) [static]
std::string ir::PTXInstruction::toString ( Level  l) [static]
std::string ir::PTXInstruction::toString ( AddressSpace  space) [static]
std::string ir::PTXInstruction::toString ( Geometry  geometry) [static]
std::string ir::PTXInstruction::toString ( ) const [virtual]

Returns a parsable string representation of the instruction

Implements ir::Instruction.

std::string ir::PTXInstruction::valid ( ) const [virtual]

Is this a valid instruction?

return null string if valid, otherwise a description of why not.

Implements ir::Instruction.


Member Data Documentation

union { ... }
union { ... }
union { ... }
union { ... }
union { ... }

Source operand a

For load and store, indicates which addressing mode to use

If instruction type is atomic, select this atomic operation

Source operand b

Indicates which type of bar. instruction should be used

Boolean operator

Branch target instruction index.

Source operand c

indicates how loads, stores, and prefetches should take place

optionally writes carry-out value to condition code register

If the instruction updates the CC, what is the CC register

how to handle out-of-bounds accesses

For tld4 instructions, the color component

Comparison operator

Destination operand

Is this a divide full instruction?

For sust and suld instructions, indicates whether to store unformatted binary datay or formatted store of a vector of 32-bit data

Geometry if this is a texture or surface instruction

Is this a kernel argument in the parameter space?

For membar, the visibility level in the thread hierarchy

Meta-data attached to the instruction.

The following are used for debugging meta-data.

Flag containing one or more floating-point modifiers

If this is a branch, is a check for re-convergence with threads waiting at the target necessary.

Opcode of PTX instruction

unsigned int ir::PTXInstruction::pc

The program counter of the instruction.

Permute mode for prmt instructions

If the instruction is predicated, the guard

Second destination register for SetP, otherwise unused

Index of post dominator instruction at which possibly divergent branches reconverge.

If the instruction is a reduction, select this operation

Context switch reentry point.

Shift amount flag for bfind instructions

The index of the statement that this instruction was created from.

The following are used for debugging information at runtime.

For txq and suq instruction, specifies attributes

For call instructions, indicates a tail call

If cvta instruction, indicates whether destination is generic address or if source is generic address - true if segmented address space, false if generic

indicates data type of instruction

Indicates whether target or source is a vector or scalar

Indicates whether the target address space is volatile


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines