Intel® Implicit SPMD Program Compiler (Intel® ISPC)  1.13.0
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
SelectExpr Class Reference

Selection expression, corresponding to "test ? a : b". More...

#include <expr.h>

Inheritance diagram for SelectExpr:
Inheritance graph
[legend]
Collaboration diagram for SelectExpr:
Collaboration graph
[legend]

Public Member Functions

 SelectExpr (Expr *test, Expr *a, Expr *b, SourcePos p)
 
llvm::Value * GetValue (FunctionEmitContext *ctx) const
 
const TypeGetType () const
 
void Print () const
 
ExprOptimize ()
 
ExprTypeCheck ()
 
int EstimateCost () const
 
- Public Member Functions inherited from Expr
 Expr (SourcePos p, unsigned scid)
 
virtual llvm::Value * GetLValue (FunctionEmitContext *ctx) const
 
virtual const TypeGetLValueType () const
 
virtual SymbolGetBaseSymbol () const
 
virtual std::pair< llvm::Constant *, bool > GetStorageConstant (const Type *type) const
 
virtual std::pair< llvm::Constant *, bool > GetConstant (const Type *type) const
 
- Public Member Functions inherited from ASTNode
 ASTNode (SourcePos p, unsigned scid)
 
virtual ~ASTNode ()
 
unsigned getValueID () const
 

Static Public Member Functions

static bool classof (SelectExpr const *)
 
static bool classof (ASTNode const *N)
 
- Static Public Member Functions inherited from Expr
static bool classof (Expr const *)
 
static bool classof (ASTNode const *N)
 
- Static Public Member Functions inherited from ASTNode
static bool classof (ASTNode const *)
 

Public Attributes

Exprtest
 
Exprexpr1
 
Exprexpr2
 
- Public Attributes inherited from ASTNode
SourcePos pos
 

Additional Inherited Members

- Public Types inherited from ASTNode
enum  ASTNodeTy {
  AddressOfExprID, AssignExprID, BinaryExprID, ConstExprID,
  DerefExprID, PtrDerefExprID, RefDerefExprID, ExprListID,
  FunctionCallExprID, FunctionSymbolExprID, IndexExprID, StructMemberExprID,
  VectorMemberExprID, NewExprID, NullPointerExprID, ReferenceExprID,
  SelectExprID, SizeOfExprID, SymbolExprID, SyncExprID,
  TypeCastExprID, UnaryExprID, MaxExprID, AssertStmtID,
  BreakStmtID, CaseStmtID, ContinueStmtID, DeclStmtID,
  DefaultStmtID, DeleteStmtID, DoStmtID, ExprStmtID,
  ForeachActiveStmtID, ForeachStmtID, ForeachUniqueStmtID, ForStmtID,
  GotoStmtID, IfStmtID, LabeledStmtID, PrintStmtID,
  ReturnStmtID, StmtListID, SwitchStmtID, UnmaskedStmtID
}
 

Detailed Description

Selection expression, corresponding to "test ? a : b".

Returns the value of "a" or "b", depending on the value of "test".

Definition at line 225 of file expr.h.

Constructor & Destructor Documentation

◆ SelectExpr()

SelectExpr::SelectExpr ( Expr test,
Expr a,
Expr b,
SourcePos  p 
)

Definition at line 3083 of file expr.cpp.

References expr1, expr2, and test.

Member Function Documentation

◆ classof() [1/2]

static bool SelectExpr::classof ( SelectExpr const *  )
inlinestatic

Definition at line 229 of file expr.h.

◆ classof() [2/2]

static bool SelectExpr::classof ( ASTNode const *  N)
inlinestatic

◆ EstimateCost()

int SelectExpr::EstimateCost ( ) const
virtual

Estimate the execution cost of the node (not including the cost of the children. The value returned should be based on the COST_* enumerant values defined in ispc.h.

Implements ASTNode.

Definition at line 3398 of file expr.cpp.

References COST_SELECT.

Referenced by GetValue().

◆ GetType()

const Type * SelectExpr::GetType ( ) const
virtual

Returns the Type of the expression.

Implements Expr.

Definition at line 3247 of file expr.cpp.

References AssertPos, expr1, expr2, Expr::GetType(), Type::IsVaryingType(), Type::MoreGeneralType(), ASTNode::pos, test, and Union().

Referenced by Print().

◆ GetValue()

llvm::Value * SelectExpr::GetValue ( FunctionEmitContext ctx) const
virtual

◆ Optimize()

Expr * SelectExpr::Optimize ( )
virtual

This method should perform early optimizations of the expression (constant folding, etc.) and return a pointer to the resulting expression. If an error is encountered during optimization, NULL should be returned.

Implements Expr.

Definition at line 3281 of file expr.cpp.

References AssertPos, Type::Equal(), expr1, expr2, Type::GetAsNonConstType(), ConstExpr::GetType(), ConstExpr::GetValues(), ISPC_MAX_NVEC, Type::IsVaryingType(), ASTNode::pos, test, AtomicType::VaryingBool, AtomicType::VaryingDouble, AtomicType::VaryingFloat, AtomicType::VaryingInt16, AtomicType::VaryingInt32, AtomicType::VaryingInt64, AtomicType::VaryingInt8, AtomicType::VaryingUInt16, AtomicType::VaryingUInt32, AtomicType::VaryingUInt64, and AtomicType::VaryingUInt8.

◆ Print()

void SelectExpr::Print ( ) const
virtual

Prints the expression to standard output (used for debugging).

Implements Expr.

Definition at line 3400 of file expr.cpp.

References expr1, expr2, GetType(), Expr::Print(), SourcePos::Print(), and test.

◆ TypeCheck()

Expr * SelectExpr::TypeCheck ( )
virtual

This method should perform type checking of the expression and return a pointer to the resulting expression. If an error is encountered, NULL should be returned.

Implements Expr.

Definition at line 3349 of file expr.cpp.

References expr1, expr2, Type::GetReferenceTarget(), Expr::GetType(), PointerType::GetUniform(), Type::IsVaryingType(), lMatchingBoolType(), Type::MoreGeneralType(), ASTNode::pos, test, TypeConvertExpr(), and Union().

Member Data Documentation

◆ expr1

Expr * SelectExpr::expr1

Definition at line 240 of file expr.h.

Referenced by GetType(), GetValue(), Optimize(), Print(), SelectExpr(), TypeCheck(), and WalkAST().

◆ expr2

Expr * SelectExpr::expr2

Definition at line 240 of file expr.h.

Referenced by GetType(), GetValue(), Optimize(), Print(), SelectExpr(), TypeCheck(), and WalkAST().

◆ test

Expr* SelectExpr::test

Definition at line 240 of file expr.h.

Referenced by GetType(), GetValue(), Optimize(), Print(), SelectExpr(), TypeCheck(), and WalkAST().


The documentation for this class was generated from the following files: