Intel SPMD Program Compiler  1.12.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
Collaboration diagram for FunctionCallExpr:
Collaboration graph

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 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 (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

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

References args, func, and launchCountExpr.

Member Function Documentation

◆ classof() [1/2]

static bool FunctionCallExpr::classof ( FunctionCallExpr const *  )

Definition at line 263 of file expr.h.

◆ classof() [2/2]

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

◆ EstimateCost()

int FunctionCallExpr::EstimateCost ( ) const

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 3635 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

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

References GetLValueType(), and GetValue().

◆ GetLValueType()

const Type * FunctionCallExpr::GetLValueType ( ) const

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

References func, FunctionType::GetReturnType(), Type::IsPointerType(), Type::IsReferenceType(), and lGetFunctionType().

Referenced by GetLValue().

◆ GetType()

const Type * FunctionCallExpr::GetType ( ) const

Returns the Type of the expression.

Implements Expr.

Definition at line 3479 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

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 3348 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 ( )

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

References args, and func.

Referenced by ExprList::GetConstant().

◆ Print()

void FunctionCallExpr::Print ( ) const

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

Implements Expr.

Definition at line 3657 of file expr.cpp.

References args, func, GetType(), isLaunch, Expr::Print(), SourcePos::Print(), and ExprList::Print().

◆ TypeCheck()

Expr * FunctionCallExpr::TypeCheck ( )

Member Data Documentation

◆ args

ExprList* FunctionCallExpr::args

Definition at line 277 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 278 of file expr.h.

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

◆ launchCountExpr

Expr* FunctionCallExpr::launchCountExpr[3]

Definition at line 279 of file expr.h.

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

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