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

#include <expr.h>

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

Public Member Functions

 SizeOfExpr (Expr *e, SourcePos p)
 
 SizeOfExpr (const Type *t, SourcePos p)
 
llvm::Value * GetValue (FunctionEmitContext *ctx) const
 
const TypeGetType () const
 
void Print () const
 
ExprTypeCheck ()
 
ExprOptimize ()
 
int EstimateCost () const
 
std::pair< llvm::Constant *, bool > GetConstant (const Type *type) const
 
- Public Member Functions inherited from Expr
 Expr (SourcePos p, unsigned scid)
 
virtual llvm::Value * GetLValue (FunctionEmitContext *ctx) const
 
virtual const TypeGetLValueType () const
 
virtual SymbolGetBaseSymbol () const
 
virtual std::pair< llvm::Constant *, bool > GetStorageConstant (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 (SizeOfExpr 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
 
const Typetype
 
- 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 that returns the size of the given expression or type in bytes.

Definition at line 608 of file expr.h.

Constructor & Destructor Documentation

◆ SizeOfExpr() [1/2]

SizeOfExpr::SizeOfExpr ( Expr e,
SourcePos  p 
)

Definition at line 7520 of file expr.cpp.

◆ SizeOfExpr() [2/2]

SizeOfExpr::SizeOfExpr ( const Type t,
SourcePos  p 
)

Definition at line 7522 of file expr.cpp.

References Type::ResolveUnboundVariability(), type, and Variability::Varying.

Member Function Documentation

◆ classof() [1/2]

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

Definition at line 613 of file expr.h.

◆ classof() [2/2]

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

◆ EstimateCost()

int SizeOfExpr::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 7570 of file expr.cpp.

◆ GetConstant()

std::pair< llvm::Constant *, bool > SizeOfExpr::GetConstant ( const Type type) const
virtual

If this is a constant expression that can be converted to a constant of the given type, this method should return the corresponding llvm::Constant value and a flag denoting if it's valid for multi-target compilation for use as an initializer of a global variable. Otherwise it should return the llvm::constant value as NULL.

Reimplemented from Expr.

Definition at line 7572 of file expr.cpp.

References Globals::ctx, expr, g, Target::getDataLayout(), Expr::GetType(), Target::IsGenericTypeLayoutIndeterminate(), Type::IsVaryingType(), Type::LLVMType(), Globals::target, and type.

◆ GetType()

const Type * SizeOfExpr::GetType ( ) const
virtual

Returns the Type of the expression.

Implements Expr.

Definition at line 7539 of file expr.cpp.

References Opt::force32BitAddressing, g, Target::is32Bit(), Globals::opt, Globals::target, AtomicType::UniformUInt32, and AtomicType::UniformUInt64.

◆ GetValue()

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

References Globals::ctx, expr, g, FunctionEmitContext::GetCurrentBasicBlock(), Expr::GetType(), Type::LLVMType(), FunctionEmitContext::SetDebugPos(), Target::SizeOf(), Globals::target, and type.

◆ Optimize()

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

◆ Print()

void SizeOfExpr::Print ( ) const
virtual

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

Implements Expr.

Definition at line 7544 of file expr.cpp.

References expr, Type::GetString(), Expr::GetType(), Expr::Print(), SourcePos::Print(), and type.

◆ TypeCheck()

Expr * SizeOfExpr::TypeCheck ( )
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 7555 of file expr.cpp.

References Error(), Type::GetString(), and type.

Member Data Documentation

◆ expr

Expr* SizeOfExpr::expr

Definition at line 626 of file expr.h.

Referenced by GetConstant(), GetValue(), Print(), and WalkAST().

◆ type

const Type* SizeOfExpr::type

Definition at line 627 of file expr.h.

Referenced by GetConstant(), GetValue(), Print(), SizeOfExpr(), and TypeCheck().


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