Intel SPMD Program Compiler  1.3.0
Public Types | Public Member Functions | Public Attributes
BinaryExpr Class Reference

Binary expression. More...

#include <expr.h>

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

List of all members.

Public Types

enum  Op {
  Add, Sub, Mul, Div,
  Mod, Shl, Shr, Lt,
  Gt, Le, Ge, Equal,
  NotEqual, BitAnd, BitXor, BitOr,
  LogicalAnd, LogicalOr, Comma
}

Public Member Functions

 BinaryExpr (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 Attributes

const Op op
Exprarg0
Exprarg1

Detailed Description

Binary expression.

Definition at line 127 of file expr.h.


Member Enumeration Documentation

Enumerator:
Add 

Addition.

Sub 

Subtraction.

Mul 

Multiplication.

Div 

Division.

Mod 

Modulus.

Shl 

Shift left.

Shr 

Shift right.

Lt 

Less than.

Gt 

Greater than.

Le 

Less than or equal.

Ge 

Greater than or equal.

Equal 

Equal.

NotEqual 

Not equal.

BitAnd 

Bitwise AND.

BitXor 

Bitwise XOR.

BitOr 

Bitwise OR.

LogicalAnd 

Logical AND.

LogicalOr 

Logical OR.

Comma 

Comma operator.

Definition at line 129 of file expr.h.


Constructor & Destructor Documentation

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

Definition at line 1617 of file expr.cpp.

References arg0, and arg1.

Referenced by Optimize().


Member Function Documentation

int BinaryExpr::EstimateCost ( ) const

Definition at line 2575 of file expr.cpp.

References arg0, arg1, COST_COMPLEX_ARITH_OP, COST_SIMPLE_ARITH_LOGIC_OP, Div, Mod, NULL, and op.

const Type * BinaryExpr::GetType ( ) const [virtual]
llvm::Value * BinaryExpr::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 1876 of file expr.cpp.

References Add, arg0, arg1, AssertPos, BitAnd, BitOr, BitXor, Comma, Div, Equal, Module::errorCount, FATAL, Ge, Expr::GetType(), Expr::GetValue(), Gt, Type::IsUnsignedType(), Type::IsVaryingType(), Le, lEmitBinaryArith(), lEmitBinaryBitOp(), lEmitBinaryCmp(), lEmitLogicalOp(), LogicalAnd, LogicalOr, Lt, m, Mod, Mul, NotEqual, NULL, op, PerformanceWarning(), FunctionEmitContext::SetDebugPos(), Shl, Shr, and Sub.

Expr * BinaryExpr::Optimize ( ) [virtual]
void BinaryExpr::Print ( ) const [virtual]

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

Implements Expr.

Definition at line 2586 of file expr.cpp.

References arg0, arg1, GetType(), lOpString(), op, Expr::Print(), and SourcePos::Print().

Expr * BinaryExpr::TypeCheck ( ) [virtual]

Member Data Documentation

Definition at line 165 of file expr.h.

Referenced by BinaryExpr(), EstimateCost(), GetType(), GetValue(), Optimize(), Print(), and TypeCheck().

Definition at line 165 of file expr.h.

Referenced by BinaryExpr(), EstimateCost(), GetType(), GetValue(), Optimize(), Print(), and TypeCheck().

Definition at line 164 of file expr.h.

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


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