Questions tagged [llvm]

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies. The llvm tag is mostly for writing C++ code (or another language via the C bindings) to interface with the LLVM library, not about any of the (growing amount of) tools that have LLVM under the hood. See the `llvm-codegen` tag for questions about machine code generated by LLVM.

Welcome to the LLVM Project.

The LLVM Core libraries provide a modern source- and target-independent optimizer, along with code generation support for many popular CPUs (as well as some less common ones!).

These libraries are built around a well specified code representation known as the LLVM intermediate representation ("LLVM IR").

The LLVM Core libraries are well documented, and it is particularly easy to invent your own language (or port an existing compiler) to use LLVM as an optimizer and code generator.

As much as everything else, LLVM has a broad and friendly community of people who are interested in building great low-level tools. If you are interested in getting involved, a good first place is to skim the LLVM Blog and to sign up for the LLVM Developer mailing list.

What not to ask: user-level questions about XCode are off-topic, please only use the tag for those. The tag is mostly for writing C++ code (or another language via the C bindings) to interface with the LLVM library, not about any of the (growing amount of) tools that have LLVM under the hood.

Books

6394 questions
21
votes
3 answers

Generating LLVM Code from Java

I want to use the LLVM code generation Framework from Java. I.e., I do not want to compile Java code into LLVM. I simply want an LLVM library for code generation that I can call from Java. The usual LLVM library is C, so I cannot use it. Are there…
gexicide
  • 38,535
  • 21
  • 92
  • 152
21
votes
2 answers

How can I specify which LLVM binaries GHC should use?

I have successfully built PortFusion with the brand new 64-bit GHC 7.6.1 Release Candidate 1 for Windows. Using freshly downloaded native 64-bit mingw binaries from http://www.drangon.org/mingw, the network package was as easy to install (after a…
Cetin Sert
  • 4,497
  • 5
  • 38
  • 76
21
votes
3 answers

How to generate an executable from an llvm::Module?

I want to write a C++ function that takes an llvm::Module, which is already linked, and output it to an executable file. It should use the llvm/clang API rather than forking a process and invoking the command-line clang. After looking through the…
jlstrecker
  • 4,953
  • 3
  • 46
  • 60
20
votes
2 answers

Sample CMakeLists.txt file for LLVM project

I am having a hard time to get LLVM to work on a new project. I've tried multiple CMakeLists.txt examples from http://old.nabble.com/CMake-sample-project--td28871124.html and used a lot of time on it. I can build LLVM and the examples perfectly but…
Lasse Espeholt
  • 17,622
  • 5
  • 63
  • 99
20
votes
4 answers

Getting LLVM/Clang to be 16 bit aligned

I am working on a legacy project that has a large amount of files dating back to pre-OS X days. It's data has been 16 bit aligned for > 15 years. I would like to move to a full LLVM compilation but I can't seem to get 2 byte alignment working. …
slycrel
  • 4,275
  • 2
  • 30
  • 30
20
votes
1 answer

Generating LLVM code for 'lambda', 'define'

So I now have a fairly complete LISP (scheme) interpreter written in haskell. Just for fun I want to try to have it compile down to LLVM. Most of the code generation seems pretty straight forward, but I'm at a loss as to how to generate code for a…
John F. Miller
  • 26,961
  • 10
  • 71
  • 121
20
votes
3 answers

Limits of Klee (the LLVM program analysis tool)

http://klee.llvm.org/ is a program analysis tool that works by symbolic execution and constraint solving, finding possible inputs that will cause a program to crash, and outputting these as test cases. It's an extremely impressive piece of…
rwallace
  • 31,405
  • 40
  • 123
  • 242
20
votes
3 answers

Why does only NSLog warn me about using the %lu string format specifier for NSUInteger?

For some reason, I get a compilation error when I try to do the following: NSLog(@"row: %lu", indexPath.row); where row is of type NSUInteger. The error I get is Conversion specifies type 'unsigned long' but the argument has type 'NSUInteger' (aka…
CIFilter
  • 8,647
  • 4
  • 46
  • 66
20
votes
1 answer

How to force clang to use some library by default?

I build clang by clang against libc++, libc++abi, compiler-rt in the following steps: To download (and update) llvm and sub-projects I use the following script: svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm cd llvm/tools svn co…
Tomilov Anatoliy
  • 15,657
  • 10
  • 64
  • 169
20
votes
4 answers

LLVM Compiler 2.0: Warning with "using namespace std;"

In Xcode using LLVM 2.0, when I put the line using namespace std; in my C++ code, I get this warning: Semantic Issue Using directive refers to implicitly-defined namespace 'std' Is there a way to fix this? Why is it giving that warning?
jstm88
  • 3,335
  • 4
  • 38
  • 55
20
votes
2 answers

How to use Clang as a compiler with Qt Creator on Windows?

I've installed Qt SDK with Qt Creator on my Windows 7. LLVM & Clang installed as well. CMake was already installed. Afterwards added Clang as a compiler into: Tools -> Options... -> Build & Run -> Compilers Then I've created Clang kit. However while…
Walking.In.The.Air
  • 682
  • 2
  • 5
  • 13
20
votes
1 answer

How to use my own Android.mk file with Android Studio

I am defining some variables within the Android.mk file (I am passing some flags for the compiler), but every time I build my project, the Android.mk is overwritten. I am assuming that Gradle is responsible and that I should be looking there? How do…
KyleM
  • 508
  • 2
  • 4
  • 11
20
votes
1 answer

What are *.td files in the LLVM / Clang source?

I'm just getting to know the LLVM / Clang source code structure and I find it hard to figure out what *.td files actually are?
georg
  • 755
  • 2
  • 7
  • 13
20
votes
1 answer

Clang and LLVM - Release vs Debug builds

It seems like a simple question, but it's taking a lot of time to figure out... In the instructions for building LLVM+Clang, a Release and a Debug configurations are mentioned. Is the debug version for: Debugging LLVM/Clang itself, OR Debugging…
Evgeni Sergeev
  • 22,495
  • 17
  • 107
  • 124
20
votes
2 answers

LLVM exception handling implementation

Just to note, I've read the questions and read the blog posts and I've also referenced the ABI. What I completely don't understand is how that interacts with LLVM's EH intrinsics. The LLVM EH page gives a very vague overview- not exactly a checklist…
Puppy
  • 144,682
  • 38
  • 256
  • 465