Intel® Implicit SPMD Program Compiler (Intel® ISPC)
1.13.0
|
Expression representing a symbol reference in the program. More...
#include <expr.h>
Public Member Functions | |
SymbolExpr (Symbol *s, SourcePos p) | |
llvm::Value * | GetValue (FunctionEmitContext *ctx) const |
llvm::Value * | GetLValue (FunctionEmitContext *ctx) const |
const Type * | GetType () const |
const Type * | GetLValueType () const |
Symbol * | GetBaseSymbol () const |
Expr * | TypeCheck () |
Expr * | Optimize () |
void | Print () const |
int | EstimateCost () const |
Public Member Functions inherited from Expr | |
Expr (SourcePos p, unsigned scid) | |
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 (SymbolExpr 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 *) |
Private Attributes | |
Symbol * | symbol |
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 } |
Public Attributes inherited from ASTNode | |
SourcePos | pos |
|
inlinestatic |
|
inlinestatic |
Definition at line 636 of file expr.h.
References ASTNode::EstimateCost(), Expr::GetBaseSymbol(), Expr::GetLValue(), Expr::GetLValueType(), Expr::GetType(), Expr::GetValue(), ASTNode::getValueID(), Expr::Optimize(), Expr::Print(), ASTNode::SymbolExprID, and Expr::TypeCheck().
|
virtual |
|
virtual |
|
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 7607 of file expr.cpp.
References FunctionEmitContext::SetDebugPos(), Symbol::storagePtr, and symbol.
|
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 7614 of file expr.cpp.
References Type::GetReferenceTarget(), PointerType::GetUniform(), symbol, and Symbol::type.
|
virtual |
Returns the Type of the expression.
Implements Expr.
Definition at line 7626 of file expr.cpp.
References symbol, and Symbol::type.
Referenced by Optimize(), and 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 7597 of file expr.cpp.
References FunctionEmitContext::LoadInst(), Symbol::name, FunctionEmitContext::SetDebugPos(), Symbol::storagePtr, symbol, and Symbol::type.
|
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 7630 of file expr.cpp.
References AssertPos, Symbol::constValue, GetType(), and symbol.
|
virtual |
Prints the expression to standard output (used for debugging).
Implements Expr.
Definition at line 7646 of file expr.cpp.
References GetType(), Symbol::name, SourcePos::Print(), and symbol.
|
virtual |
|
private |
Definition at line 649 of file expr.h.
Referenced by GetBaseSymbol(), GetLValue(), GetLValueType(), GetType(), GetValue(), Optimize(), Print(), and SymbolExpr().