Intel® Implicit SPMD Program Compiler (Intel® ISPC)
1.13.0
|
Expression representing indexing into something with an integer offset. More...
#include <expr.h>
Public Member Functions | |
IndexExpr (Expr *baseExpr, Expr *index, 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 |
void | Print () const |
Expr * | Optimize () |
Expr * | TypeCheck () |
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 (IndexExpr 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 * | baseExpr |
Expr * | index |
Public Attributes inherited from ASTNode | |
SourcePos | pos |
Private Attributes | |
const Type * | type |
const PointerType * | lvalueType |
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 } |
Expression representing indexing into something with an integer offset.
This is used for both array indexing and indexing into VectorTypes.
|
inlinestatic |
|
inlinestatic |
Definition at line 304 of file expr.h.
References ASTNode::EstimateCost(), Expr::GetBaseSymbol(), Expr::GetLValue(), Expr::GetLValueType(), Expr::GetType(), Expr::GetValue(), ASTNode::getValueID(), ASTNode::IndexExprID, 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 4426 of file expr.cpp.
References baseExpr, COST_GATHER, COST_LOAD, Expr::GetType(), index, and Type::IsVaryingType().
|
virtual |
For expressions that have values based on a symbol (e.g. regular symbol references, array indexing, etc.), this returns a pointer to that symbol.
Reimplemented from Expr.
Definition at line 4164 of file expr.cpp.
References baseExpr, and Expr::GetBaseSymbol().
Referenced by GetValue().
|
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 4233 of file expr.cpp.
References AssertPos, baseExpr, Module::errorCount, FunctionEmitContext::GetElementPtrInst(), Expr::GetLValue(), Expr::GetLValueType(), GetLValueType(), Type::GetReferenceTarget(), Expr::GetType(), PointerType::GetUniform(), Expr::GetValue(), index, lAddVaryingOffsetsIfNeeded(), lCheckIndicesVersusBounds(), lConvertPtrToSliceIfNeeded(), LLVMGetName(), LLVMInt32(), m, and FunctionEmitContext::SetDebugPos().
Referenced by 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 4297 of file expr.cpp.
References AssertPos, baseExpr, PointerType::GetAsSlice(), Type::GetBaseType(), PointerType::GetBaseType(), SequentialType::GetElementType(), Expr::GetLValueType(), Type::GetReferenceTarget(), Expr::GetType(), PointerType::GetUniform(), PointerType::GetVarying(), index, Type::IsSOAType(), Type::IsUniformType(), Type::IsVaryingType(), and lvalueType.
Referenced by StructMemberExpr::classof(), GetLValue(), and GetValue().
|
virtual |
Returns the Type of the expression.
Implements Expr.
Definition at line 4121 of file expr.cpp.
References AssertPos, baseExpr, Type::GetAsUniformType(), Type::GetAsVaryingType(), PointerType::GetBaseType(), SequentialType::GetElementType(), Type::GetReferenceTarget(), Expr::GetType(), index, Type::IsSOAType(), Type::IsUniformType(), and type.
Referenced by StructMemberExpr::classof(), GetValue(), 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 4062 of file expr.cpp.
References FunctionEmitContext::AllocaInst(), Assert, AssertPos, baseExpr, Module::errorCount, GetBaseSymbol(), FunctionEmitContext::GetElementPtrInst(), SequentialType::GetElementType(), GetLValue(), GetLValueType(), Expr::GetType(), GetType(), PointerType::GetUniform(), Expr::GetValue(), index, Type::IsVaryingType(), lAddVaryingOffsetsIfNeeded(), LLVMInt32(), LLVMMaskAllOn, lMaskForSymbol(), FunctionEmitContext::LoadInst(), lVaryingStructHasUniformMember(), m, FunctionEmitContext::SetDebugPos(), and FunctionEmitContext::StoreInst().
|
virtual |
|
virtual |
Prints the expression to standard output (used for debugging).
Implements Expr.
Definition at line 4442 of file expr.cpp.
References baseExpr, GetType(), index, Expr::Print(), and SourcePos::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 4361 of file expr.cpp.
References AssertPos, baseExpr, Opt::disableUniformMemoryOptimizations, Type::EqualIgnoringConst(), Error(), Module::errorCount, Opt::force32BitAddressing, g, Type::GetAsUniformType(), Type::GetReferenceTarget(), Type::GetString(), Expr::GetType(), index, Target::is32Bit(), Type::IsUniformType(), m, Globals::opt, Globals::target, TypeConvertExpr(), AtomicType::UniformInt32, AtomicType::UniformInt64, AtomicType::UniformUInt64, and AtomicType::VaryingInt32.
Expr* IndexExpr::baseExpr |
Definition at line 317 of file expr.h.
Referenced by EstimateCost(), GetBaseSymbol(), GetLValue(), GetLValueType(), GetType(), GetValue(), IndexExpr(), lCheckAllOffSafety(), Optimize(), Print(), TypeCheck(), and WalkAST().
Expr * IndexExpr::index |
Definition at line 317 of file expr.h.
Referenced by EstimateCost(), GetLValue(), GetLValueType(), GetType(), GetValue(), IndexExpr(), lCheckAllOffSafety(), lCheckIndicesVersusBounds(), Optimize(), Print(), TypeCheck(), and WalkAST().
|
mutableprivate |
Definition at line 321 of file expr.h.
Referenced by GetLValueType(), and IndexExpr().
|
mutableprivate |
Definition at line 320 of file expr.h.
Referenced by GetType(), IndexExpr(), and lVaryingStructHasUniformMember().