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
18
votes
1 answer

Is self.iVar necessary for strong properties with ARC?

If I declare a property strong, like so: @property (strong, nonatomic) UIView *iVar; When I'm setting it, does it matter if I do iVar = ... or self.iVar = ...? It seems that with ARC, they do the same thing. If I only declare the instance variable…
ma11hew28
  • 121,420
  • 116
  • 450
  • 651
18
votes
3 answers

If a subclass refers to a superclass ivar, synthesizing an unrelated property fails

Edit: I just noticed this other Stack Overflow question asking much the same thing: Why does a subclass @property with no corresponding ivar hide superclass ivars? This is some interesting behavior that I cannot find documented in anything official…
erikprice
  • 6,240
  • 3
  • 30
  • 40
18
votes
7 answers

How can I find the current Rust compiler's default LLVM target triple?

I want to override a build script, which means adding a configuration section that looks like this: [target.x86_64-unknown-linux-gnu.foo] rustc-link-search = ["/path/to/foo"] rustc-link-lib = ["foo"] root = "/path/to/foo" key = "value" But I'm…
Roger Lipscombe
  • 89,048
  • 55
  • 235
  • 380
18
votes
3 answers

Recompile a x86 code with LLVM to some faster one x86

Is it possible to run LLVM compiler with input of x86 32bit code? There is a huge algorithm which I have no source code and I want to make it run faster on the same hardware. Can I translate it from x86 back to x86 with optimizations. This Code runs…
osgx
  • 90,338
  • 53
  • 357
  • 513
18
votes
7 answers

clang: error: clang frontend command failed with exit code 70 (use -v to see invocation)

I don't know what causes it. It does not happen at iPhone 5 and simulators. It have been happened only my original device iPhone 7. fatal error: error in backend: Error while trying to spill X0 from class GPR64: Cannot scavenge register without an…
Junhyun Lee
  • 183
  • 1
  • 1
  • 4
18
votes
1 answer

Attempting to write an LLVM backend. No good tutorial available

I am trying to write an LLVM backend for my custom processor that I have designed recently. I tried to follow the official tutorial at http://llvm.org/docs/WritingAnLLVMBackend.html But it is so vague, so incomplete and blurry that I failed to…
Dr. Ehsan Ali
  • 4,735
  • 4
  • 23
  • 37
18
votes
1 answer

How to uninstall LLVM?

I installed LLVM from source (using CMake and make install) but I am unable to uninstall it because there is no make uninstall avalaible. This is LLVM version 3.5.2. I use ArchLinux. How can I uninstall LLVM in an automated way?
antoyo
  • 11,097
  • 7
  • 51
  • 82
18
votes
1 answer

How can I build the post-dominator tree of a function with an endless loop?

One of my side projects is a decompiler that turns native code into LLVM IR, simplifies it and outputs pseudo-C. An essential phase of the program's process is pattern-independent control flow structuring, which finds regions in a program and turns…
zneak
  • 134,922
  • 42
  • 253
  • 328
18
votes
1 answer

What does `clang-check` do without `-analyze` option?

clang-check, Clang's built-in static analysis tool, has an -analyze option, for which the help string just says "Run static analysis engine." With this flag, I see very little output from running clang-check on several of my files; without it, I see…
Kyle Strand
  • 15,941
  • 8
  • 72
  • 167
18
votes
5 answers

llvm: How to get the label of Basic Blocks

I have written a pass to detect and print the label of basicblocks in a function, for I want to use splitBasicBlock() further. I wrote that like this: virtual bool runOnModule(Module &M) { for(Module::iterator F = M.begin(), E = M.end(); F!= E;…
winter333
  • 337
  • 1
  • 2
  • 10
18
votes
3 answers

What is the reason for the creation of LLVM?

What are the differences between an LLVM and a regular compiler? Is it more dynamic and thus can be used to compile normally very dynamic languages (i.e. Javascript) into static binary code? What are the principles behind creating one? I know the…
the_drow
  • 18,571
  • 25
  • 126
  • 193
18
votes
1 answer

How can I get function name from CallInst in LLVM?

I have an object of type CallInst. How can I get the name of the called function (aka callee). Assume the function is called directly (i.e., no indirect function calls).
pythonic
  • 20,589
  • 43
  • 136
  • 219
18
votes
1 answer

How to switch off LLVM's integrated assembler?

I have a project involving hand-written assembly—AT&T syntax, works fine with GCC, but not done by me plus I know very little about assembly—which exhibits a weird problem when trying to build it with Clang. LLVM documentation mentions that "most…
hermannloose
  • 889
  • 6
  • 13
17
votes
4 answers

Is it possible to use LLVM-assembly directly?

I have read some webpages and articles about llvm and I am quite interested in this project. (Maybe to learn something about compiler writing without the need to struggle with the complicated points of x86). There are pages that describe how to…
fuz
  • 88,405
  • 25
  • 200
  • 352
17
votes
2 answers

Why do static inline data members not end up in a .bss section on Macos?

Trying out snmalloc on Macos I wondered why all the created binaries are >256MiB. It turns out that zero-initialized static inline data members are lowered in a weird way on Mac OS X, on both ARM64 and x86_64. Even this simple test produces huge…
HHK
  • 4,852
  • 1
  • 23
  • 40