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

Member Enumeration Documentation

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

Constructor & Destructor Documentation

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

Definition at line 2946 of file expr.cpp.

References lvalue, and rvalue.

Member Function Documentation

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

Definition at line 204 of file expr.h.

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

Definition at line 205 of file expr.h.

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

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

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

const Type * AssignExpr::GetType ( ) const
virtual

Returns the Type of the expression.

Implements Expr.

Definition at line 3021 of file expr.cpp.

References Expr::GetType(), and lvalue.

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

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 2954 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.

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

References lvalue, and rvalue.

void AssignExpr::Print ( ) const
virtual

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

Implements Expr.

Definition at line 3155 of file expr.cpp.

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

Expr * AssignExpr::TypeCheck ( )
virtual

Member Data Documentation

Expr* AssignExpr::lvalue

Definition at line 218 of file expr.h.

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

const Op AssignExpr::op

Definition at line 217 of file expr.h.

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

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: