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

#include <expr.h>

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

Public Member Functions

 NewExpr (int typeQual, const Type *type, Expr *initializer, Expr *count, SourcePos tqPos, SourcePos p)
 
llvm::Value * GetValue (FunctionEmitContext *ctx) const
 
const TypeGetType () const
 
ExprTypeCheck ()
 
ExprOptimize ()
 
void Print () const
 
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 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 (NewExpr 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

const TypeallocType
 
ExprcountExpr
 
ExprinitExpr
 
bool isVarying
 
- 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

An expression representing a "new" expression, used for dynamically allocating memory.

Definition at line 745 of file expr.h.

Constructor & Destructor Documentation

◆ NewExpr()

NewExpr::NewExpr ( int  typeQual,
const Type type,
Expr initializer,
Expr count,
SourcePos  tqPos,
SourcePos  p 
)

Member Function Documentation

◆ classof() [1/2]

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

Definition at line 749 of file expr.h.

◆ classof() [2/2]

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

◆ EstimateCost()

int NewExpr::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 8302 of file expr.cpp.

References COST_NEW.

◆ GetType()

const Type * NewExpr::GetType ( ) const
virtual

Returns the Type of the expression.

Implements Expr.

Definition at line 8240 of file expr.cpp.

References allocType, PointerType::GetUniform(), PointerType::GetVarying(), and isVarying.

Referenced by GetValue().

◆ GetValue()

llvm::Value * NewExpr::GetValue ( FunctionEmitContext ctx) const
virtual

◆ Optimize()

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

◆ Print()

void NewExpr::Print ( ) const
virtual

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

Implements Expr.

Definition at line 8300 of file expr.cpp.

References allocType, and Type::GetString().

◆ TypeCheck()

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

References allocType, AssertPos, countExpr, Error(), Module::errorCount, Opt::force32BitAddressing, g, Type::GetAsVaryingType(), Type::GetString(), Expr::GetType(), Target::is32Bit(), StructType::IsDefined(), isVarying, Type::IsVaryingType(), m, Globals::opt, Globals::target, TypeConvertExpr(), AtomicType::UniformUInt32, and AtomicType::UniformUInt64.

Member Data Documentation

◆ allocType

const Type* NewExpr::allocType

Type of object to allocate storage for.

Definition at line 760 of file expr.h.

Referenced by GetType(), GetValue(), NewExpr(), Print(), and TypeCheck().

◆ countExpr

Expr* NewExpr::countExpr

Expression giving the number of elements to allocate, when the "new Foo[expr]" form is used. This may be NULL, in which case a single element of the given type will be allocated.

Definition at line 764 of file expr.h.

Referenced by GetValue(), NewExpr(), TypeCheck(), and WalkAST().

◆ initExpr

Expr* NewExpr::initExpr

Optional initializer expression used to initialize the allocated memory.

Definition at line 767 of file expr.h.

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

◆ isVarying

bool NewExpr::isVarying

Indicates whether this is a "varying new" or "uniform new" (i.e. whether a separate allocation is performed per program instance, or whether a single allocation is performed for the entire gang of program instances.)

Definition at line 772 of file expr.h.

Referenced by GetType(), GetValue(), NewExpr(), and TypeCheck().


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