tags:

views:

133

answers:

2

I'm compiling with clang-llvm 1.0 on Xcode 3.2.1

I want to see LLVM's intermidiate representation. How do I do this ?

Thanks.

A: 

Per LLVM's site, I would add -emit-llvm to the compiler options. Xcode does not provide UI for showing the representation (yet).

refulgentis
Thanks, but -emit-llvm is indeed an llvm feature, which does not help me with Xcode. My problem is seeing the IR in Xcode; I find it hard to believe that XCode recognizes the file format (it does - check the menues), but does not let you see it when you are degbugging.
David Lehavi
+1  A: 

Xcode does have support for syntax highlighting the LLVM intermediate representation, but this representation is internal to the compiler (and changes frequently) and Xcode doesn't have any UI for talking to the compiler to show the intermediate representation in the UI. This would be an interesting feature request though, have you consider filing it with Apple?

If you just want to see it, you can do so manually by taking the compile command from the build log, and adding '-emit-llvm -S -o /tmp/t.ll' to the end. Now you can open /tmp/t.ll in Xcode and see the LLVM IR for that one file.

Daniel Dunbar
As I said in the comment to the remark below, I know both how to see the llvm IR in xcode, and how to produce the llvm code (which is an llvm feature - not xcode). What I don't know is how to trace the llvm code together with the original, which is a pitty (and should be very easy to do). My experience with apple is that their customer support is good, but development support is not.
David Lehavi
Ok. There isn't currently a good way to view the LLVM code together with the original source code. Technically this is available to some extent via http://klee.llvm.org via some KCacheGrind integration. However, I am probably the only person who uses it; it is somewhat complicated to install and use (although it is possible on OS X).I agree that this would be a great feature to have natively in Xcode. I recommend you file a feature request for it, you never know!
Daniel Dunbar