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

Expression representing a function call. More...

#include <expr.h>

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

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 TypeGetType () const
 
const TypeGetLValueType () const
 
void Print () const
 
ExprOptimize ()
 
ExprTypeCheck ()
 
int EstimateCost () const
 
- Public Member Functions inherited from Expr
 Expr (SourcePos p, unsigned scid)
 
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 (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

Exprfunc
 
ExprListargs
 
bool isLaunch
 
ExprlaunchCountExpr [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
}
 

Detailed Description

Expression representing a function call.

Definition at line 271 of file expr.h.

Constructor & Destructor Documentation

◆ FunctionCallExpr()

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.

Member Function Documentation

◆ classof() [1/2]

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

Definition at line 275 of file expr.h.

◆ classof() [2/2]

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

◆ EstimateCost()

int FunctionCallExpr::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 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().

◆ GetLValue()

llvm::Value * FunctionCallExpr::GetLValue ( FunctionEmitContext ctx) const
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().

◆ GetLValueType()

const Type * FunctionCallExpr::GetLValueType ( ) const
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().

◆ GetType()

const Type * FunctionCallExpr::GetType ( ) const
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().

◆ GetValue()

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

◆ Optimize()

Expr * FunctionCallExpr::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 3598 of file expr.cpp.

References args, and func.

Referenced by lGetExprListConstant().

◆ Print()

void FunctionCallExpr::Print ( ) const
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().

◆ TypeCheck()

Expr * FunctionCallExpr::TypeCheck ( )
virtual

Member Data Documentation

◆ args

ExprList* FunctionCallExpr::args

Definition at line 289 of file expr.h.

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

◆ func

Expr* FunctionCallExpr::func

◆ isLaunch

bool FunctionCallExpr::isLaunch

Definition at line 290 of file expr.h.

Referenced by EstimateCost(), Print(), and TypeCheck().

◆ launchCountExpr

Expr* FunctionCallExpr::launchCountExpr[3]

Definition at line 291 of file expr.h.

Referenced by FunctionCallExpr(), GetValue(), TypeCheck(), and WalkAST().


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