[LLVMdev] Optimized code analysis problems
Eli Friedman
eli.friedman at gmail.com
Sat Jan 31 13:48:45 PST 2009
On Sat, Jan 31, 2009 at 1:14 PM, Nipun Arora <nipun2512 at gmail.com> wrote:
> Hii,
>
> Thanks for the response, yes I couldn't find any way to extract the names
> through any of the passes.
> Where could I potentially insert a hack so that any function call to
> intrinsic functions or library functions can be retrieved?
> Could you gimme any ideas for the start?
Basically, there is no mapping from the llvm.* names to the _mm_*
names; the transformation is lossy.
You have a couple options here: one is to manipulate the source to let
you see the _mm_ names, and the other is to catch the _mm_ names
before the inliner runs.
Manipulating the source isn't actually very hard, although it's a
non-trivial amount of work; basically, you create your own xmmintrin.h
that doesn't have inline implementations, and mess with the include
paths so the compiler picks your version rather than the builtin
version. That way, once you transform to IL, the _mm_ calls will stay
as _mm_ calls.
If you're using the standard headers, the _mm_ function are defined as
inline functions, so at least in trunk LLVM builds, they exist in the
IL at some point. They're gone by the time llvm-gcc outputs the IL,
though, because the inliner unconditionally inlines them. So to get
the _mm_ names, you'll have to hack the llvm-gcc source to disable the
inlining pass.
-Eli
More information about the llvm-dev
mailing list