Intel SPMD Program Compiler  1.9.1
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
 
- 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 llvm::Constant * 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 (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 643 of file expr.h.

Constructor & Destructor Documentation

SizeOfExpr::SizeOfExpr ( Expr e,
SourcePos  p 
)

Definition at line 7848 of file expr.cpp.

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

Definition at line 7853 of file expr.cpp.

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

Member Function Documentation

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

Definition at line 648 of file expr.h.

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

Definition at line 649 of file expr.h.

References ASTNode::getValueID(), and ASTNode::SizeOfExprID.

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 7923 of file expr.cpp.

const Type * SizeOfExpr::GetType ( ) const
virtual

Returns the Type of the expression.

Implements Expr.

Definition at line 7875 of file expr.cpp.

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

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 7860 of file expr.cpp.

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

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 7917 of file expr.cpp.

void SizeOfExpr::Print ( ) const
virtual

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

Implements Expr.

Definition at line 7882 of file expr.cpp.

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

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 7895 of file expr.cpp.

References Error(), g, Target::getISA(), Type::GetString(), Type::IsVaryingType(), Globals::target, and type.

Member Data Documentation

Expr* SizeOfExpr::expr

Definition at line 662 of file expr.h.

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

const Type* SizeOfExpr::type

Definition at line 663 of file expr.h.

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


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