Intel SPMD Program Compiler  1.9.1
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 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 (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 798 of file expr.h.

Constructor & Destructor Documentation

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

Member Function Documentation

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

Definition at line 803 of file expr.h.

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

Definition at line 804 of file expr.h.

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

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

References COST_NEW.

const Type * NewExpr::GetType ( ) const
virtual

Returns the Type of the expression.

Implements Expr.

Definition at line 8727 of file expr.cpp.

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

Referenced by GetValue().

llvm::Value * NewExpr::GetValue ( FunctionEmitContext ctx) const
virtual
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 8793 of file expr.cpp.

void NewExpr::Print ( ) const
virtual

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

Implements Expr.

Definition at line 8799 of file expr.cpp.

References allocType, and Type::GetString().

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

References allocType, AssertPos, countExpr, Error(), Module::errorCount, Opt::force32BitAddressing, g, Type::GetAsVaryingType(), Target::getISA(), 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

const Type* NewExpr::allocType

Type of object to allocate storage for.

Definition at line 816 of file expr.h.

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

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 820 of file expr.h.

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

Expr* NewExpr::initExpr

Optional initializer expression used to initialize the allocated memory.

Definition at line 823 of file expr.h.

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

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 828 of file expr.h.

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


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