#include <BoundsEmitter.h>
Public Types | |
typedef std::pair< llvm::Value *, llvm::Value * > | LUPair |
Public Member Functions | |
BoundsEmitter (CodeGenRoutine &CGR) | |
const llvm::StructType * | getType (const ArrayType *arrTy) |
Returns the LLVM type which represents the bounds of the given Comma array type. | |
llvm::Value * | synthScalarBounds (llvm::IRBuilder<> &Builder, const DiscreteType *type) |
LUPair | getScalarBounds (llvm::IRBuilder<> &Builder, const DiscreteType *type) |
llvm::Value * | getLowerBound (llvm::IRBuilder<> &Builder, const DiscreteType *type) |
llvm::Value * | getUpperBound (llvm::IRBuilder<> &Builder, const DiscreteType *type) |
llvm::Value * | getLowerBound (llvm::IRBuilder<> &Builder, const Range *range) |
Evaluates the given range and returns the lower bound. | |
llvm::Value * | getUpperBound (llvm::IRBuilder<> &Builder, const Range *range) |
Evaluates the given range and returns the upper bound. | |
llvm::Value * | synthRange (llvm::IRBuilder<> &Builder, const Range *range) |
Evaluates a range and returns a corresponding bounds structure. | |
llvm::Value * | synthRange (llvm::IRBuilder<> &Builder, llvm::Value *lower, llvm::Value *upper) |
LUPair | getRange (llvm::IRBuilder<> &Builder, const Range *range) |
Evaluates a range and returns the lower and upper bounds as a pair. | |
llvm::Value * | computeBoundLength (llvm::IRBuilder<> &Builder, llvm::Value *bounds, unsigned index) |
llvm::Value * | computeTotalBoundLength (llvm::IRBuilder<> &Builder, llvm::Value *bounds) |
llvm::Value * | computeIsNull (llvm::IRBuilder<> &Builder, llvm::Value *bounds, unsigned index) |
llvm::Value * | synthArrayBounds (llvm::IRBuilder<> &Builder, ArrayType *arrTy) |
Computes the bounds of the given array type. | |
llvm::Constant * | synthStaticArrayBounds (llvm::IRBuilder<> &Builder, ArrayType *arrTy) |
Given an array type with statically constrained indices, synthesizes a constant LLVM structure representing the bounds of the array. | |
llvm::Value * | synthAggregateBounds (llvm::IRBuilder<> &Builder, AggregateExpr *agg, llvm::Value *dst=0) |
Static Public Member Functions | |
static llvm::Value * | getLowerBound (llvm::IRBuilder<> &Builder, llvm::Value *bounds, unsigned index) |
Returns the lower bound at the given index. | |
static llvm::Value * | getUpperBound (llvm::IRBuilder<> &Builder, llvm::Value *bounds, unsigned index) |
Returns the upper bound at the given index. | |
static LUPair | getBounds (llvm::IRBuilder<> &Builder, llvm::Value *bounds, unsigned index) |
Definition at line 38 of file BoundsEmitter.h.
typedef std::pair<llvm::Value*, llvm::Value*> comma::BoundsEmitter::LUPair |
Several methods return a std::pair of values representing a range. The following typedef provides a shorthand. The first component of such a pair contains the lower bound and the second component contains the upper bound.
Definition at line 47 of file BoundsEmitter.h.
BoundsEmitter::BoundsEmitter | ( | CodeGenRoutine & | CGR | ) |
Definition at line 45 of file BoundsEmitter.cpp.
llvm::Value * BoundsEmitter::computeBoundLength | ( | llvm::IRBuilder<> & | Builder, | |
llvm::Value * | bounds, | |||
unsigned | index | |||
) |
Emits code which computes the length of the given bounds value.
The returned Value is always an i32. This may change in the future when LLVM supports i64 alloca's.
Definition at line 190 of file BoundsEmitter.cpp.
llvm::Value * BoundsEmitter::computeIsNull | ( | llvm::IRBuilder<> & | Builder, | |
llvm::Value * | bounds, | |||
unsigned | index | |||
) |
Emits code which tests if the given bounds object has a null range at the given index. The reuturn value is always an i1.
Definition at line 247 of file BoundsEmitter.cpp.
llvm::Value * BoundsEmitter::computeTotalBoundLength | ( | llvm::IRBuilder<> & | Builder, | |
llvm::Value * | bounds | |||
) |
Emits code which computes the total length of the given bounds value.
Like computeBoundLength(), this method returns an i32.
Definition at line 222 of file BoundsEmitter.cpp.
static LUPair comma::BoundsEmitter::getBounds | ( | llvm::IRBuilder<> & | Builder, | |
llvm::Value * | bounds, | |||
unsigned | index | |||
) | [inline, static] |
Convenience method to pack the results of getLowerBound() and getUpperBound() into a std::pair.
Definition at line 86 of file BoundsEmitter.h.
llvm::Value * BoundsEmitter::getLowerBound | ( | llvm::IRBuilder<> & | Builder, | |
const Range * | range | |||
) |
Evaluates the given range and returns the lower bound.
Definition at line 129 of file BoundsEmitter.cpp.
llvm::Value * BoundsEmitter::getLowerBound | ( | llvm::IRBuilder<> & | Builder, | |
const DiscreteType * | type | |||
) |
Evaluates the range of the given scalar type and returns the lower bound.
Definition at line 103 of file BoundsEmitter.cpp.
static llvm::Value* comma::BoundsEmitter::getLowerBound | ( | llvm::IRBuilder<> & | Builder, | |
llvm::Value * | bounds, | |||
unsigned | index | |||
) | [inline, static] |
Returns the lower bound at the given index.
Definition at line 57 of file BoundsEmitter.h.
BoundsEmitter::LUPair BoundsEmitter::getRange | ( | llvm::IRBuilder<> & | Builder, | |
const Range * | range | |||
) |
Evaluates a range and returns the lower and upper bounds as a pair.
Definition at line 182 of file BoundsEmitter.cpp.
BoundsEmitter::LUPair BoundsEmitter::getScalarBounds | ( | llvm::IRBuilder<> & | Builder, | |
const DiscreteType * | type | |||
) |
Evaluates the range of the given scalar type and returns the lower and upper bounds as a pair.
If the current frame has a bounds entry for the given type this method will use them. Otherwise, if the type has dynamic constraints, the computed bounds are registered with the frame and associated with the type.
Definition at line 66 of file BoundsEmitter.cpp.
const llvm::StructType * BoundsEmitter::getType | ( | const ArrayType * | arrTy | ) |
Returns the LLVM type which represents the bounds of the given Comma array type.
Definition at line 50 of file BoundsEmitter.cpp.
llvm::Value * BoundsEmitter::getUpperBound | ( | llvm::IRBuilder<> & | Builder, | |
const Range * | range | |||
) |
Evaluates the given range and returns the upper bound.
Definition at line 144 of file BoundsEmitter.cpp.
llvm::Value * BoundsEmitter::getUpperBound | ( | llvm::IRBuilder<> & | Builder, | |
const DiscreteType * | type | |||
) |
Evaluates the range of the given scalar type and returns the upper bound.
Definition at line 116 of file BoundsEmitter.cpp.
static llvm::Value* comma::BoundsEmitter::getUpperBound | ( | llvm::IRBuilder<> & | Builder, | |
llvm::Value * | bounds, | |||
unsigned | index | |||
) | [inline, static] |
Returns the upper bound at the given index.
Definition at line 71 of file BoundsEmitter.h.
llvm::Value * BoundsEmitter::synthAggregateBounds | ( | llvm::IRBuilder<> & | Builder, | |
AggregateExpr * | agg, | |||
llvm::Value * | dst = 0 | |||
) |
Constructs an LLVM structure object representing the bounds of the given positional aggregate expression.
If dst
is non-null the synthesized bounds are stored into the given location.
Definition at line 297 of file BoundsEmitter.cpp.
llvm::Value * BoundsEmitter::synthArrayBounds | ( | llvm::IRBuilder<> & | Builder, | |
ArrayType * | arrTy | |||
) |
Computes the bounds of the given array type.
Definition at line 255 of file BoundsEmitter.cpp.
llvm::Value * BoundsEmitter::synthRange | ( | llvm::IRBuilder<> & | Builder, | |
llvm::Value * | lower, | |||
llvm::Value * | upper | |||
) |
Packs the given values into a bounds structure.
Both values must be of the same integer type.
Definition at line 168 of file BoundsEmitter.cpp.
llvm::Value * BoundsEmitter::synthRange | ( | llvm::IRBuilder<> & | Builder, | |
const Range * | range | |||
) |
Evaluates a range and returns a corresponding bounds structure.
Definition at line 159 of file BoundsEmitter.cpp.
llvm::Value * BoundsEmitter::synthScalarBounds | ( | llvm::IRBuilder<> & | Builder, | |
const DiscreteType * | type | |||
) |
Evaluates the range of the given scalar type and returns a corresponding bounds structure.
If the current frame has a bounds entry for the given type this method will use them. Otherwise, if the type has dynamic constraints, the computed bounds are registered with the frame and associated with the type.
Definition at line 55 of file BoundsEmitter.cpp.
llvm::Constant * BoundsEmitter::synthStaticArrayBounds | ( | llvm::IRBuilder<> & | Builder, | |
ArrayType * | arrTy | |||
) |
Given an array type with statically constrained indices, synthesizes a constant LLVM structure representing the bounds of the array.
Definition at line 276 of file BoundsEmitter.cpp.