Intel® Implicit SPMD Program Compiler (Intel® ISPC)  1.13.0
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
DerefExpr Class Reference

Common base class that provides shared functionality for PtrDerefExpr and RefDerefExpr. More...

#include <expr.h>

Inheritance diagram for DerefExpr:
Inheritance graph
[legend]
Collaboration diagram for DerefExpr:
Collaboration graph
[legend]

Public Member Functions

 DerefExpr (Expr *e, SourcePos p, unsigned scid=DerefExprID)
 
llvm::Value * GetValue (FunctionEmitContext *ctx) const
 
llvm::Value * GetLValue (FunctionEmitContext *ctx) const
 
const TypeGetLValueType () const
 
SymbolGetBaseSymbol () const
 
ExprOptimize ()
 
- Public Member Functions inherited from Expr
 Expr (SourcePos p, unsigned scid)
 
virtual const TypeGetType () const =0
 
virtual std::pair< llvm::Constant *, bool > GetStorageConstant (const Type *type) const
 
virtual std::pair< llvm::Constant *, bool > GetConstant (const Type *type) const
 
virtual ExprTypeCheck ()=0
 
virtual void Print () const =0
 
- Public Member Functions inherited from ASTNode
 ASTNode (SourcePos p, unsigned scid)
 
virtual ~ASTNode ()
 
virtual int EstimateCost () const =0
 
unsigned getValueID () const
 

Static Public Member Functions

static bool classof (DerefExpr 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

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

Common base class that provides shared functionality for PtrDerefExpr and RefDerefExpr.

Definition at line 536 of file expr.h.

Constructor & Destructor Documentation

◆ DerefExpr()

DerefExpr::DerefExpr ( Expr e,
SourcePos  p,
unsigned  scid = DerefExprID 
)

Definition at line 7222 of file expr.cpp.

References expr.

Member Function Documentation

◆ classof() [1/2]

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

Definition at line 540 of file expr.h.

◆ classof() [2/2]

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

◆ GetBaseSymbol()

Symbol * DerefExpr::GetBaseSymbol ( ) const
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 7259 of file expr.cpp.

References expr, and Expr::GetBaseSymbol().

◆ GetLValue()

llvm::Value * DerefExpr::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 7247 of file expr.cpp.

References expr, and Expr::GetValue().

◆ GetLValueType()

const Type * DerefExpr::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 7253 of file expr.cpp.

References expr, and Expr::GetType().

◆ GetValue()

llvm::Value * DerefExpr::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 7224 of file expr.cpp.

References expr, Expr::GetBaseSymbol(), FunctionEmitContext::GetFullMask(), Expr::GetType(), Expr::GetValue(), lAddVaryingOffsetsIfNeeded(), lMaskForSymbol(), FunctionEmitContext::LoadInst(), lVaryingStructHasUniformMember(), and FunctionEmitContext::SetDebugPos().

Referenced by lEmitPrePostIncDec().

◆ Optimize()

Expr * DerefExpr::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 7261 of file expr.cpp.

References expr.

Member Data Documentation

◆ expr

Expr* DerefExpr::expr

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