Intel SPMD Program Compiler  1.3.0
Public Member Functions | Public Attributes | Private Attributes
IndexExpr Class Reference

Expression representing indexing into something with an integer offset. More...

#include <expr.h>

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

List of all members.

Public Member Functions

 IndexExpr (Expr *baseExpr, Expr *index, SourcePos p)
llvm::Value * GetValue (FunctionEmitContext *ctx) const
llvm::Value * GetLValue (FunctionEmitContext *ctx) const
const TypeGetType () const
const TypeGetLValueType () const
SymbolGetBaseSymbol () const
void Print () const
ExprOptimize ()
ExprTypeCheck ()
int EstimateCost () const

Public Attributes

ExprbaseExpr
Exprindex

Private Attributes

const Typetype
const PointerTypelvalueType

Detailed Description

Expression representing indexing into something with an integer offset.

This is used for both array indexing and indexing into VectorTypes.

Definition at line 271 of file expr.h.


Constructor & Destructor Documentation

IndexExpr::IndexExpr ( Expr baseExpr,
Expr index,
SourcePos  p 
)

Definition at line 3814 of file expr.cpp.

References baseExpr, index, lvalueType, NULL, and type.


Member Function Documentation

int IndexExpr::EstimateCost ( ) const

Definition at line 4317 of file expr.cpp.

References baseExpr, COST_GATHER, COST_LOAD, Expr::GetType(), index, Type::IsVaryingType(), and NULL.

Symbol * IndexExpr::GetBaseSymbol ( ) const [virtual]

For expressions that have values based on a symbol (e.g. regular symbol references, array indexing, etc.), this returns a pointer to that symbol.

Reimplemented from Expr.

Definition at line 4047 of file expr.cpp.

References baseExpr, Expr::GetBaseSymbol(), and NULL.

Referenced by GetValue().

llvm::Value * IndexExpr::GetLValue ( FunctionEmitContext ctx) const [virtual]

For expressions that can provide an lvalue (e.g. array indexing), this function should emit IR that computes the expression's lvalue and returns the corresponding llvm::Value. Expressions that can't provide an lvalue should leave this unimplemented; the default implementation returns NULL.

Reimplemented from Expr.

Definition at line 4128 of file expr.cpp.

References AssertPos, baseExpr, Module::errorCount, FunctionEmitContext::GetElementPtrInst(), Expr::GetLValue(), Expr::GetLValueType(), GetLValueType(), Type::GetReferenceTarget(), Expr::GetType(), PointerType::GetUniform(), Expr::GetValue(), index, lAddVaryingOffsetsIfNeeded(), lCheckIndicesVersusBounds(), lConvertPtrToSliceIfNeeded(), LLVMGetName(), LLVMInt32(), m, NULL, and FunctionEmitContext::SetDebugPos().

Referenced by GetValue().

const Type * IndexExpr::GetLValueType ( ) const [virtual]
const Type * IndexExpr::GetType ( ) const [virtual]
llvm::Value * IndexExpr::GetValue ( FunctionEmitContext ctx) const [virtual]
Expr * IndexExpr::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 4258 of file expr.cpp.

References baseExpr, index, and NULL.

void IndexExpr::Print ( ) const [virtual]

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

Implements Expr.

Definition at line 4336 of file expr.cpp.

References baseExpr, GetType(), index, Expr::Print(), and SourcePos::Print().

Expr * IndexExpr::TypeCheck ( ) [virtual]

Member Data Documentation

const PointerType* IndexExpr::lvalueType [mutable, private]

Definition at line 290 of file expr.h.

Referenced by GetLValueType(), and IndexExpr().

const Type* IndexExpr::type [mutable, private]

Definition at line 289 of file expr.h.

Referenced by GetType(), and IndexExpr().


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