Intel® Implicit SPMD Program Compiler (Intel® ISPC)
1.13.0
|
Selection expression, corresponding to "test ? a : b". More...
#include <expr.h>
Public Member Functions | |
SelectExpr (Expr *test, Expr *a, Expr *b, SourcePos p) | |
llvm::Value * | GetValue (FunctionEmitContext *ctx) const |
const Type * | GetType () const |
void | Print () const |
Expr * | Optimize () |
Expr * | TypeCheck () |
int | EstimateCost () const |
Public Member Functions inherited from Expr | |
Expr (SourcePos p, unsigned scid) | |
virtual llvm::Value * | GetLValue (FunctionEmitContext *ctx) const |
virtual const Type * | GetLValueType () const |
virtual Symbol * | GetBaseSymbol () 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 | |
Expr * | test |
Expr * | expr1 |
Expr * | expr2 |
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 } |
Selection expression, corresponding to "test ? a : b".
Returns the value of "a" or "b", depending on the value of "test".
|
inlinestatic |
|
inlinestatic |
Definition at line 230 of file expr.h.
References ASTNode::EstimateCost(), Expr::GetType(), Expr::GetValue(), ASTNode::getValueID(), Expr::Optimize(), Expr::Print(), ASTNode::SelectExprID, and Expr::TypeCheck().
|
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().
|
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().
|
virtual |
This is the main method for Expr implementations to implement. It should call methods in the FunctionEmitContext to emit LLVM IR instructions to the current basic block in order to generate an llvm::Value that represents the expression's value.
Implements Expr.
Definition at line 3126 of file expr.cpp.
References FunctionEmitContext::AllocaInst(), AssertPos, FunctionEmitContext::BranchInst(), FunctionEmitContext::CreateBasicBlock(), Globals::ctx, Debug(), Type::Equal(), EstimateCost(), expr1, expr2, FunctionEmitContext::ExtractInst(), g, Type::GetAsNonConstType(), Type::GetBaseType(), FunctionEmitContext::GetCurrentBasicBlock(), VectorType::GetElementCount(), VectorType::GetElementType(), FunctionEmitContext::GetFullMask(), FunctionEmitContext::GetInternalMask(), Expr::GetType(), Expr::GetValue(), FunctionEmitContext::InsertInst(), Type::IsUniformType(), lEmitSelectExprCode(), lEmitVaryingSelect(), Type::LLVMType(), FunctionEmitContext::LoadInst(), LLVMTypes::MaskType, FunctionEmitContext::NotOperator(), FunctionEmitContext::PhiNode(), ASTNode::pos, PREDICATE_SAFE_IF_STATEMENT_COST, SafeToRunWithMaskAllOff(), FunctionEmitContext::SelectInst(), FunctionEmitContext::SetCurrentBasicBlock(), FunctionEmitContext::SetDebugPos(), FunctionEmitContext::SetInternalMask(), FunctionEmitContext::SetInternalMaskAnd(), FunctionEmitContext::SetInternalMaskAndNot(), FunctionEmitContext::StoreInst(), test, AtomicType::UniformBool, and AtomicType::VaryingBool.
|
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.
|
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.
|
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().
Expr * SelectExpr::expr1 |
Definition at line 240 of file expr.h.
Referenced by GetType(), GetValue(), Optimize(), Print(), SelectExpr(), TypeCheck(), and WalkAST().
Expr * SelectExpr::expr2 |
Definition at line 240 of file expr.h.
Referenced by GetType(), GetValue(), Optimize(), Print(), SelectExpr(), TypeCheck(), and WalkAST().
Expr* SelectExpr::test |
Definition at line 240 of file expr.h.
Referenced by GetType(), GetValue(), Optimize(), Print(), SelectExpr(), TypeCheck(), and WalkAST().