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

Assignment expression. More...

#include <expr.h>

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

Public Types

enum  Op {
  Assign, MulAssign, DivAssign, ModAssign,
  AddAssign, SubAssign, ShlAssign, ShrAssign,
  AndAssign, XorAssign, OrAssign
}
 
- 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
}
 

Public Member Functions

 AssignExpr (Op o, Expr *a, Expr *b, SourcePos p)
 
llvm::Value * GetValue (FunctionEmitContext *ctx) const
 
const TypeGetType () const
 
void Print () const
 
ExprOptimize ()
 
ExprTypeCheck ()
 
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 (AssignExpr 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 Op op
 
Exprlvalue
 
Exprrvalue
 
- Public Attributes inherited from ASTNode
SourcePos pos
 

Detailed Description

Assignment expression.

Definition at line 188 of file expr.h.

Member Enumeration Documentation

◆ Op

Enumerator
Assign 

Regular assignment.

MulAssign 

*= assignment

DivAssign 

/= assignment

ModAssign 

%= assignment

AddAssign 

+= assignment

SubAssign 

-= assignment

ShlAssign 

<<= assignment

ShrAssign 

>>= assignment

AndAssign 

&= assignment

XorAssign 

^= assignment

OrAssign 

|= assignment

Definition at line 190 of file expr.h.

Constructor & Destructor Documentation

◆ AssignExpr()

AssignExpr::AssignExpr ( AssignExpr::Op  o,
Expr a,
Expr b,
SourcePos  p 
)

Definition at line 2881 of file expr.cpp.

References lvalue, and rvalue.

Member Function Documentation

◆ classof() [1/2]

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

Definition at line 206 of file expr.h.

◆ classof() [2/2]

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

◆ EstimateCost()

int AssignExpr::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 3059 of file expr.cpp.

References Assign, COST_ASSIGN, COST_COMPLEX_ARITH_OP, COST_SIMPLE_ARITH_LOGIC_OP, DivAssign, ModAssign, and op.

◆ GetType()

const Type * AssignExpr::GetType ( ) const
virtual

Returns the Type of the expression.

Implements Expr.

Definition at line 2947 of file expr.cpp.

References Expr::GetType(), and lvalue.

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

◆ GetValue()

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

References AddAssign, AndAssign, AssertPos, Assign, DivAssign, Error(), Module::errorCount, FATAL, Expr::GetBaseSymbol(), Expr::GetLValue(), Expr::GetLValueType(), Expr::GetType(), GetType(), Expr::GetValue(), lEmitOpAssign(), lStoreAssignResult(), lvalue, m, ModAssign, MulAssign, op, OrAssign, ASTNode::pos, rvalue, FunctionEmitContext::SetDebugPos(), ShlAssign, ShrAssign, SubAssign, and XorAssign.

◆ Optimize()

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

References lvalue, and rvalue.

◆ Print()

void AssignExpr::Print ( ) const
virtual

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

Implements Expr.

Definition at line 3068 of file expr.cpp.

References GetType(), lOpString(), lvalue, op, Expr::Print(), SourcePos::Print(), and rvalue.

◆ TypeCheck()

Expr * AssignExpr::TypeCheck ( )
virtual

Member Data Documentation

◆ lvalue

Expr* AssignExpr::lvalue

Definition at line 218 of file expr.h.

Referenced by AssignExpr(), GetType(), GetValue(), Optimize(), Print(), TypeCheck(), and WalkAST().

◆ op

const Op AssignExpr::op

Definition at line 217 of file expr.h.

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

◆ rvalue

Expr * AssignExpr::rvalue

Definition at line 218 of file expr.h.

Referenced by AssignExpr(), GetValue(), Optimize(), Print(), TypeCheck(), and WalkAST().


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