On Saturday 12 September 2009 07:19, dhruv choudhary
wrote:> Hello,
>
> I am new to LLVM. I am using an x86 code generator. I need to write a few
> passes based on cache blocks and data layout information. Does LLVM provide
> a way for me to see the data layout and analyze what are the cache blocks?
> If not is it possible to implement the same in the current framework?
I've done some of this in our code. Depending on what you want to do, you
often don't need to know the exact cache layout of data. It's
sufficient to
reason about the relationships of objects to each other. So you need to know
things about padding and so forth.
For example, to determine whether two accesses to an array might conflict in
the cache, you might look at their objects' relative starting position in
the
address space (either as globals or locals -- dynamic allocations are a
crapshoot) and determine whether there is enough "space" between the
accesses
to reasonably guess that they won't interfere.
Scalar evolution is essential for this kind of thing and by just adding a bit
more on top you can figure most of this out.
-Dave