Intel SPMD Program Compiler  1.9.1
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 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

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 276 of file expr.h.

Constructor & Destructor Documentation

FunctionCallExpr::FunctionCallExpr ( Expr func,
ExprList args,
SourcePos  p,
bool  isLaunch = false,
Expr launchCountExpr[3] = NULL 
)

Definition at line 3555 of file expr.cpp.

References args, func, and launchCountExpr.

Member Function Documentation

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

Definition at line 282 of file expr.h.

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

Definition at line 283 of file expr.h.

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

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 3910 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().

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

References GetLValueType(), and GetValue().

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

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

Referenced by GetLValue().

const Type * FunctionCallExpr::GetType ( ) const
virtual

Returns the Type of the expression.

Implements Expr.

Definition at line 3738 of file expr.cpp.

References args, FullResolveOverloads(), func, FunctionType::GetReturnType(), lGetFunctionType(), ASTNode::pos, and FunctionSymbolExpr::ResolveOverloads().

Referenced by Print().

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 3591 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().

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

References args, and func.

void FunctionCallExpr::Print ( ) const
virtual

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

Implements Expr.

Definition at line 3934 of file expr.cpp.

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

Expr * FunctionCallExpr::TypeCheck ( )
virtual

Member Data Documentation

ExprList* FunctionCallExpr::args

Definition at line 298 of file expr.h.

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

Expr* FunctionCallExpr::func
bool FunctionCallExpr::isLaunch

Definition at line 299 of file expr.h.

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

Expr* FunctionCallExpr::launchCountExpr[3]

Definition at line 300 of file expr.h.

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


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