Use llvm TargetData to find object sizes, offsets.

Previously, to compute the size of objects and the offsets of struct
elements within structs, we were using the trick of using getelementpointer 
with a NULL base pointer and then casting the result to an int32/64.
However, since we actually know the target we're compiling for at
compile time, we can use corresponding methods from TargetData to
get these values directly.

This mostly cleans up code, but may make some of the gather/scatter
lowering to loads/stores optimizations work better in the presence
of structures.
This commit is contained in:
Matt Pharr
2011-11-06 19:31:19 -08:00
parent 7a1ce558e9
commit f8eb100c60
5 changed files with 49 additions and 167 deletions

3
ctx.h
View File

@@ -226,9 +226,6 @@ public:
i32. */
llvm::Value *I1VecToBoolVec(llvm::Value *b);
/** Returns the size of the given type. */
llvm::Value *SizeOf(LLVM_TYPE_CONST llvm::Type *ty);
/** If the user has asked to compile the program with instrumentation,
this inserts a callback to the user-supplied instrumentation
function at the current point in the code. */