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
36
votes
3 answers

Functional languages targeting the LLVM

Are there any languages that target the LLVM that: Are statically typed Use type inference Are functional (i.e. lambda expressions, closures, list primitives, list comprehensions, etc.) Have first class object-oriented features (inheritance,…
Matthew
  • 2,151
  • 2
  • 17
  • 13
36
votes
2 answers

In Xcode project target build settings, What is Mach-O Type?

After getting tired of numerous Match-O linker error, I want to know that this thing means. Instead of trial and error solution, I would like to know the concept behind these things. Specifically I want to know the difference between…
Max
  • 3,371
  • 2
  • 29
  • 30
35
votes
5 answers

How to tell Clang to stop pretending to be other compilers?

I've run into this issue in the past: LLVM defines __GNUC__, but it can't consume a program GCC can. I'm experiencing it again on Windows: LLVM defines _MSC_VER, but it can't consume the same program VC++ can. The aggravating thing (for me) is we…
jww
  • 97,681
  • 90
  • 411
  • 885
34
votes
5 answers

Under what conditions is @synthesize automatic in Objective-c?

Under what conditions is @synthesize automatic in Objective-c? Perhaps when using LLVM 3.0 and up? From reading around the net it seems like @synthesize is unnecessary starting with Xcode 4. However I'm using Xcode 4 and receiving warnings when I…
SundayMonday
  • 19,147
  • 29
  • 100
  • 154
34
votes
5 answers

Compile Swift to WebAssembly

The LLVM infrastructure now supports compiling from LLVM IR to WebAssembly (at least experimentally). Swift uses the LLVM compiler infrastructure and can easily be compiled to LLVM IR. So I thought it would be straightforward to compile some Swift…
Rob Mecham
  • 593
  • 7
  • 9
34
votes
2 answers

Why am I getting "undefined reference to `dladdr'" even with -ldl for this simple program?

I'm working through an LLVM Tutorial, but I'm having trouble compiling. I've written a minimal example that reproduces the issue: #include "llvm/Module.h" #include "llvm/LLVMContext.h" int main(int argc, char **argv) { llvm::Module *module =…
Matthew
  • 28,056
  • 26
  • 104
  • 170
33
votes
7 answers

Opinions on Unladen Swallow?

What are your opinions and expectations on Google's Unladen Swallow? From their project plan: We want to make Python faster, but we also want to make it easy for large, well-established applications to switch to Unladen Swallow. Produce a…
vartec
  • 131,205
  • 36
  • 218
  • 244
32
votes
3 answers

LLVM get constant integer back from Value*

I create a llvm::Value* from a integer constant like this: llvm::Value* constValue = llvm::ConstantInt::get( llvmContext , llvm::APInt( node->someInt() )); now i want to retrieve the compile-time constant value back; int constIntValue =…
lurscher
  • 25,930
  • 29
  • 122
  • 185
32
votes
3 answers

How to make AddressSanitizer not stop after one error (and other issues)

I'm running OS X, 10.8.5; I've installed llvm 3.4 via homebrew (clang version 3.4 (tags/RELEASE_34/final) ), and I'm building with -fsanitize=address. I can get asan working with simple demo programs, but when building against our codebase, I have…
Steve Broberg
  • 4,255
  • 3
  • 28
  • 40
32
votes
1 answer

What is GCC_NO_COMMON_BLOCKS used for?

I found that my project sets GCC_NO_COMMON_BLOCKS = NO under Apple LLVM Compiler 3.1 - Code Generation settings, as "No Common Blocks" I would like to know: what is that flag used for? Thanks a lot
Lio
  • 4,225
  • 4
  • 33
  • 40
31
votes
6 answers

Translation of machinecode into LLVM IR (disassembly / reassembly of X86_64. X86. ARM into LLVM bitcode)

I would like to translate X86_64, x86, ARM executables into LLVM IR (disassembly). What solution do you suggest ?
Grzegorz Wierzowiecki
  • 10,545
  • 9
  • 50
  • 88
31
votes
4 answers

When choosing a functional programming language for use with LLVM, what are the trade-offs?

Let's assume for the moment that C++ is not a functional programming language. If you want to write a compiler using LLVM for the back-end, and you want to use a functional programming language and its bindings to LLVM to do your work, you have two…
james woodyatt
  • 2,170
  • 17
  • 17
30
votes
2 answers

Setting disassembly flavour to Intel in LLDB

Is there a way to set the disassembly flavour like there is in GDB within LLDB so that it spits out Intel style assembly rather than AT&T style? set disassembly-flavor intel # GDB but for LLDB.
X-Istence
  • 16,324
  • 6
  • 57
  • 74
30
votes
7 answers

How to build the latest clang-tidy?

I've tried to build clang-tidy from sources but it complains about an undefined CMake command: CMake Error at clang-apply-replacements/CMakeLists.txt:5 (add_clang_library): Unknown CMake command "add_clang_library". CMake Warning (dev) in…
ruipacheco
  • 15,025
  • 19
  • 82
  • 138
30
votes
2 answers

Static, extern and inline in Objective-C

What do static, extern and inline (and their combinations) mean in Objetive-C using the LLVM compiler? Also, I noticed that there are CG_EXTERN and CG_INLINE macros. Should we be using those instead? (I couldn't find a source with a clear…
hpique
  • 119,096
  • 131
  • 338
  • 476