Intel SPMD Program Compiler  1.9.1
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 llvm::Constant * 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 226 of file expr.h.

Constructor & Destructor Documentation

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

Definition at line 3171 of file expr.cpp.

References expr1, expr2, and test.

Member Function Documentation

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

Definition at line 230 of file expr.h.

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

Definition at line 231 of file expr.h.

References ASTNode::getValueID(), and ASTNode::SelectExprID.

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 3531 of file expr.cpp.

References COST_SELECT.

Referenced by GetValue().

const Type * SelectExpr::GetType ( ) const
virtual

Returns the Type of the expression.

Implements Expr.

Definition at line 3362 of file expr.cpp.

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

Referenced by Print().

llvm::Value * SelectExpr::GetValue ( FunctionEmitContext ctx) const
virtual
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 3402 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.

void SelectExpr::Print ( ) const
virtual

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

Implements Expr.

Definition at line 3537 of file expr.cpp.

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

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 3482 of file expr.cpp.

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

Member Data Documentation

Expr * SelectExpr::expr1

Definition at line 243 of file expr.h.

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

Expr * SelectExpr::expr2

Definition at line 243 of file expr.h.

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

Expr* SelectExpr::test

Definition at line 243 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: