Intel® Implicit SPMD Program Compiler (Intel® ISPC)
1.13.0
|
Expression representing a function call. More...
#include <expr.h>
Public Member Functions | |
FunctionCallExpr (Expr *func, ExprList *args, SourcePos p, bool isLaunch=false, Expr *launchCountExpr[3]=NULL) | |
llvm::Value * | GetValue (FunctionEmitContext *ctx) const |
llvm::Value * | GetLValue (FunctionEmitContext *ctx) const |
const Type * | GetType () const |
const Type * | GetLValueType () const |
void | Print () const |
Expr * | Optimize () |
Expr * | TypeCheck () |
int | EstimateCost () const |
Public Member Functions inherited from Expr | |
Expr (SourcePos p, unsigned scid) | |
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 (FunctionCallExpr 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 * | func |
ExprList * | args |
bool | isLaunch |
Expr * | launchCountExpr [3] |
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 } |
FunctionCallExpr::FunctionCallExpr | ( | Expr * | func, |
ExprList * | args, | ||
SourcePos | p, | ||
bool | isLaunch = false , |
||
Expr * | launchCountExpr[3] = NULL |
||
) |
Definition at line 3417 of file expr.cpp.
References args, func, and launchCountExpr.
|
inlinestatic |
|
inlinestatic |
Definition at line 276 of file expr.h.
References ASTNode::EstimateCost(), ASTNode::FunctionCallExprID, Expr::GetLValue(), Expr::GetLValueType(), Expr::GetType(), Expr::GetValue(), ASTNode::getValueID(), Expr::Optimize(), Expr::Print(), 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 3730 of file expr.cpp.
References COST_FUNCALL, COST_FUNPTR_UNIFORM, COST_FUNPTR_VARYING, COST_TASK_LAUNCH, FunctionType::costOverride, func, Type::GetBaseType(), Expr::GetType(), isLaunch, and Type::IsUniformType().
|
virtual |
For expressions that can provide an lvalue (e.g. array indexing), this function should emit IR that computes the expression's lvalue and returns the corresponding llvm::Value. Expressions that can't provide an lvalue should leave this unimplemented; the default implementation returns NULL.
Reimplemented from Expr.
Definition at line 3548 of file expr.cpp.
References GetLValueType(), and GetValue().
|
virtual |
Returns the type of the value returned by GetLValueType(); this should be a pointer type of some sort (uniform or varying).
Reimplemented from Expr.
Definition at line 3587 of file expr.cpp.
References func, FunctionType::GetReturnType(), Type::IsPointerType(), Type::IsReferenceType(), and lGetFunctionType().
Referenced by GetLValue().
|
virtual |
Returns the Type of the expression.
Implements Expr.
Definition at line 3574 of file expr.cpp.
References args, FullResolveOverloads(), func, FunctionType::GetReturnType(), lGetFunctionType(), ASTNode::pos, and FunctionSymbolExpr::ResolveOverloads().
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 3446 of file expr.cpp.
References args, AssertPos, FunctionEmitContext::CallInst(), Error(), Module::errorCount, ExprList::exprs, func, Expr::GetLValueType(), FunctionType::GetNumParameters(), FunctionType::GetParameterDefault(), FunctionType::GetParameterType(), FunctionType::GetReturnType(), Type::GetString(), Expr::GetValue(), FunctionType::isTask, Type::IsVaryingType(), Type::IsVoidType(), launchCountExpr, FunctionEmitContext::LaunchInst(), lGetFunctionType(), m, ASTNode::pos, FunctionEmitContext::SetDebugPos(), and TypeConvertExpr().
Referenced by GetLValue().
|
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 3598 of file expr.cpp.
Referenced by lGetExprListConstant().
|
virtual |
Prints the expression to standard output (used for debugging).
Implements Expr.
Definition at line 3752 of file expr.cpp.
References args, func, GetType(), isLaunch, Expr::Print(), SourcePos::Print(), and ExprList::Print().
|
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 3604 of file expr.cpp.
References args, AssertPos, CanConvertTypes(), Error(), ExprList::exprs, FullResolveOverloads(), func, Type::GetBaseType(), PointerType::GetBaseType(), FunctionType::GetNumParameters(), FunctionType::GetParameterDefault(), FunctionType::GetParameterType(), FunctionType::GetReturnType(), Type::GetString(), Expr::GetType(), isLaunch, FunctionType::isTask, Type::IsUniformType(), Type::IsVaryingType(), Type::IsVoidType(), launchCountExpr, ASTNode::pos, FunctionSymbolExpr::ResolveOverloads(), TypeConvertExpr(), and AtomicType::UniformInt32.
ExprList* FunctionCallExpr::args |
Definition at line 289 of file expr.h.
Referenced by FunctionCallExpr(), GetType(), GetValue(), Optimize(), Print(), TypeCheck(), and WalkAST().
Expr* FunctionCallExpr::func |
Definition at line 288 of file expr.h.
Referenced by EstimateCost(), FunctionCallExpr(), GetLValueType(), GetType(), GetValue(), lCheckAllOffSafety(), Optimize(), Print(), TypeCheck(), and WalkAST().
bool FunctionCallExpr::isLaunch |
Definition at line 290 of file expr.h.
Referenced by EstimateCost(), Print(), and TypeCheck().
Expr* FunctionCallExpr::launchCountExpr[3] |
Definition at line 291 of file expr.h.
Referenced by FunctionCallExpr(), GetValue(), TypeCheck(), and WalkAST().