|
Intel SPMD Program Compiler
1.3.0
|
Expression representing indexing into something with an integer offset. More...
#include <expr.h>


Public Member Functions | |
| IndexExpr (Expr *baseExpr, Expr *index, SourcePos p) | |
| llvm::Value * | GetValue (FunctionEmitContext *ctx) const |
| llvm::Value * | GetLValue (FunctionEmitContext *ctx) const |
| const Type * | GetType () const |
| const Type * | GetLValueType () const |
| Symbol * | GetBaseSymbol () const |
| void | Print () const |
| Expr * | Optimize () |
| Expr * | TypeCheck () |
| int | EstimateCost () const |
Public Attributes | |
| Expr * | baseExpr |
| Expr * | index |
Private Attributes | |
| const Type * | type |
| const PointerType * | lvalueType |
Expression representing indexing into something with an integer offset.
This is used for both array indexing and indexing into VectorTypes.
| 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] |
Returns the type of the value returned by GetLValueType(); this should be a pointer type of some sort (uniform or varying).
Reimplemented from Expr.
Definition at line 4201 of file expr.cpp.
References AssertPos, baseExpr, PointerType::GetAsSlice(), Type::GetBaseType(), PointerType::GetBaseType(), SequentialType::GetElementType(), Expr::GetLValueType(), Type::GetReferenceTarget(), Expr::GetType(), PointerType::GetUniform(), PointerType::GetVarying(), index, Type::IsSOAType(), Type::IsUniformType(), Type::IsVaryingType(), lvalueType, and NULL.
Referenced by GetLValue(), and GetValue().
| const Type * IndexExpr::GetType | ( | ) | const [virtual] |
Returns the Type of the expression.
Implements Expr.
Definition at line 3999 of file expr.cpp.
References AssertPos, baseExpr, Type::GetAsUniformType(), Type::GetAsVaryingType(), PointerType::GetBaseType(), SequentialType::GetElementType(), Type::GetReferenceTarget(), Expr::GetType(), index, Type::IsSOAType(), Type::IsUniformType(), NULL, and type.
Referenced by GetValue(), and Print().
| llvm::Value * IndexExpr::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 3939 of file expr.cpp.
References FunctionEmitContext::AllocaInst(), AssertPos, baseExpr, Globals::ctx, Module::errorCount, g, GetBaseSymbol(), FunctionEmitContext::GetElementPtrInst(), SequentialType::GetElementType(), GetLValue(), GetLValueType(), Expr::GetType(), GetType(), PointerType::GetUniform(), Expr::GetValue(), index, Type::IsVaryingType(), lAddVaryingOffsetsIfNeeded(), LLVMInt32(), LLVMMaskAllOn, Type::LLVMType(), lMaskForSymbol(), FunctionEmitContext::LoadInst(), lVaryingStructHasUniformMember(), m, NULL, FunctionEmitContext::SetDebugPos(), and FunctionEmitContext::StoreInst().
| Expr * IndexExpr::Optimize | ( | ) | [virtual] |
| 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] |
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 4266 of file expr.cpp.
References AssertPos, baseExpr, Opt::disableUniformMemoryOptimizations, Type::Equal(), Type::EqualIgnoringConst(), Error(), Module::errorCount, Opt::force32BitAddressing, g, Type::GetAsUniformType(), AtomicType::GetBaseType(), Type::GetReferenceTarget(), Type::GetString(), Expr::GetType(), index, Target::is32Bit, Type::IsUniformType(), m, NULL, Globals::opt, Globals::target, TypeConvertExpr(), AtomicType::UniformInt32, AtomicType::UniformInt64, AtomicType::VaryingInt32, and AtomicType::Void.
Definition at line 286 of file expr.h.
Referenced by EstimateCost(), GetBaseSymbol(), GetLValue(), GetLValueType(), GetType(), GetValue(), IndexExpr(), Optimize(), Print(), and TypeCheck().
Definition at line 286 of file expr.h.
Referenced by EstimateCost(), GetLValue(), GetLValueType(), GetType(), GetValue(), IndexExpr(), Optimize(), Print(), and TypeCheck().
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().
1.7.5.1