Intel® Implicit SPMD Program Compiler (Intel® ISPC)
1.13.0
|
Expression representing member selection ("foo.bar"). More...
#include <expr.h>
Public Member Functions | |
llvm::Value * | GetValue (FunctionEmitContext *ctx) const |
llvm::Value * | GetLValue (FunctionEmitContext *ctx) const |
const Type * | GetType () const |
Symbol * | GetBaseSymbol () const |
void | Print () const |
Expr * | Optimize () |
Expr * | TypeCheck () |
int | EstimateCost () const |
virtual int | getElementNumber () const =0 |
virtual const Type * | getElementType () const =0 |
std::string | getCandidateNearMatches () const |
MemberExpr (Expr *expr, const char *identifier, SourcePos pos, SourcePos identifierPos, bool derefLValue, unsigned scid) | |
Public Member Functions inherited from Expr | |
Expr (SourcePos p, unsigned scid) | |
virtual const Type * | GetLValueType () 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 MemberExpr * | create (Expr *expr, const char *identifier, SourcePos pos, SourcePos identifierPos, bool derefLvalue) |
static bool | classof (MemberExpr 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 * | expr |
std::string | identifier |
const SourcePos | identifierPos |
bool | dereferenceExpr |
Public Attributes inherited from ASTNode | |
SourcePos | pos |
Protected Attributes | |
const Type * | type |
const Type * | 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 member selection ("foo.bar").
This will also be overloaded to deal with swizzles.
MemberExpr::MemberExpr | ( | Expr * | expr, |
const char * | identifier, | ||
SourcePos | pos, | ||
SourcePos | identifierPos, | ||
bool | derefLValue, | ||
unsigned | scid | ||
) |
Definition at line 4882 of file expr.cpp.
References dereferenceExpr, expr, identifier, lvalueType, and type.
|
inlinestatic |
|
inlinestatic |
Definition at line 334 of file expr.h.
References ASTNode::EstimateCost(), Expr::GetBaseSymbol(), Expr::GetLValue(), Expr::GetType(), Expr::GetValue(), ASTNode::getValueID(), Expr::Optimize(), Expr::Print(), ASTNode::StructMemberExprID, Expr::TypeCheck(), and ASTNode::VectorMemberExprID.
|
static |
Definition at line 4811 of file expr.cpp.
References Assert, Error(), PointerType::GetBaseType(), Type::GetReferenceTarget(), Type::GetString(), Expr::GetType(), StructType::IsDefined(), ASTNode::pos, TypeCheck(), and VectorMemberExpr::VectorMemberExpr().
|
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 4970 of file expr.cpp.
References COST_GATHER, COST_SIMPLE_ARITH_LOGIC_OP, Expr::GetLValueType(), Type::IsVaryingType(), and lvalueType.
|
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 4935 of file expr.cpp.
References expr, and Expr::GetBaseSymbol().
Referenced by GetValue().
std::string MemberExpr::getCandidateNearMatches | ( | ) | const |
There is no structure member with the name we've got in "identifier". Use the approximate string matching routine to see if the identifier is a minor misspelling of one of the ones that is there.
Definition at line 4992 of file expr.cpp.
References expr, StructType::GetElementCount(), StructType::GetElementName(), Expr::GetType(), identifier, and MatchStrings().
Referenced by StructMemberExpr::getElementNumber(), and StructMemberExpr::GetType().
|
pure virtual |
Implemented in VectorMemberExpr, and StructMemberExpr.
Definition at line 4937 of file expr.cpp.
Referenced by GetLValue(), and GetValue().
|
pure virtual |
Implemented in VectorMemberExpr, and StructMemberExpr.
|
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 4939 of file expr.cpp.
References FunctionEmitContext::AddElementOffset(), AssertPos, dereferenceExpr, Module::errorCount, expr, getElementNumber(), Expr::GetLValue(), Expr::GetLValueType(), Expr::GetType(), Expr::GetValue(), lAddVaryingOffsetsIfNeeded(), m, and FunctionEmitContext::SetDebugPos().
Referenced by VectorMemberExpr::classof(), VectorMemberExpr::GetLValue(), and GetValue().
|
virtual |
|
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 4890 of file expr.cpp.
References FunctionEmitContext::AddElementOffset(), FunctionEmitContext::AllocaInst(), AssertPos, Module::errorCount, expr, GetBaseSymbol(), getElementNumber(), GetLValue(), Expr::GetLValueType(), Expr::GetType(), GetType(), PointerType::GetUniform(), Expr::GetValue(), identifier, LLVMGetName(), LLVMMaskAllOn, lMaskForSymbol(), FunctionEmitContext::LoadInst(), lvalueType, m, FunctionEmitContext::SetDebugPos(), and FunctionEmitContext::StoreInst().
Referenced by VectorMemberExpr::classof(), and VectorMemberExpr::GetValue().
|
virtual |
|
virtual |
Prints the expression to standard output (used for debugging).
Implements Expr.
Definition at line 4978 of file expr.cpp.
References expr, GetType(), identifier, Expr::Print(), and SourcePos::Print().
|
virtual |
bool MemberExpr::dereferenceExpr |
Indicates whether the expression should be dereferenced before the member is found. (i.e. this is true if the MemberExpr was a '->' operator, and is false if it was a '.' operator.
Definition at line 361 of file expr.h.
Referenced by GetLValue(), StructMemberExpr::GetLValueType(), VectorMemberExpr::GetLValueType(), StructMemberExpr::getStructType(), VectorMemberExpr::GetValue(), lCheckAllOffSafety(), and MemberExpr().
Expr* MemberExpr::expr |
Definition at line 351 of file expr.h.
Referenced by GetBaseSymbol(), getCandidateNearMatches(), GetLValue(), StructMemberExpr::GetLValueType(), VectorMemberExpr::GetLValueType(), StructMemberExpr::getStructType(), StructMemberExpr::GetType(), GetValue(), VectorMemberExpr::GetValue(), MemberExpr(), Optimize(), Print(), TypeCheck(), and WalkAST().
std::string MemberExpr::identifier |
Definition at line 352 of file expr.h.
Referenced by getCandidateNearMatches(), StructMemberExpr::getElementNumber(), VectorMemberExpr::getElementNumber(), StructMemberExpr::getElementType(), VectorMemberExpr::GetLValue(), VectorMemberExpr::GetLValueType(), StructMemberExpr::GetType(), VectorMemberExpr::GetType(), GetValue(), VectorMemberExpr::GetValue(), MemberExpr(), Print(), and VectorMemberExpr::VectorMemberExpr().
const SourcePos MemberExpr::identifierPos |
Definition at line 353 of file expr.h.
Referenced by StructMemberExpr::getElementNumber(), and StructMemberExpr::GetType().
|
mutableprotected |
Definition at line 364 of file expr.h.
Referenced by EstimateCost(), StructMemberExpr::GetLValueType(), VectorMemberExpr::GetLValueType(), StructMemberExpr::GetType(), GetValue(), and MemberExpr().
|
mutableprotected |
Definition at line 364 of file expr.h.
Referenced by StructMemberExpr::getStructType(), StructMemberExpr::GetType(), VectorMemberExpr::GetType(), and MemberExpr().