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

What effect does compiling to LLVM bytecode, then to machine code have on speed, etc?

I ask because, with the increasing popularity of mobile computing on ARM devices, the continued need for backwards-compatible X86 devices, and newer technologies like quantum computing, which will have completely different architectures, an…
3
votes
2 answers

Julia: Julia 1.9.0 :ERROR: LoadError: Unable to open libLLVM! when llvm is installed in Windows environment

I get an error message when I add SeisIO package in Julia 1.9.0 (Windows 11 environment),which introduces me that"ERROR: Error building LightXML:ERROR: LoadError: Unable to open libLLVM!".Codes are following: (@v1.9) pkg> add SeisIO; build;…
3
votes
3 answers

Why does LLVM complain about missing function prototypes?

LLVM 2.1 has an option that enables warnings for "missing function prototypes." When enabled, the warning will complain about a file like this: double square( double d ) { return d*d; } void main() { // ... } The function "square" will…
OldPeculier
  • 11,049
  • 13
  • 50
  • 76
3
votes
1 answer

LLVM complains about assembler error "Unexpected token in memory operand"

I'm doing a study assignment to measure memory access time on my machine. To determine the clock cycles on our machines, we have been given the following C snippet: static inline void getcyclecount(uint64_t* cycles) { __asm __volatile( …
Patrick
  • 4,720
  • 4
  • 41
  • 71
3
votes
0 answers

Does the llvm-bolt instrumentation mode result in less accurate BOLT profiles?

The BOLT binary optimizer recommends using perf to profile binaries for optimization. However, if "perf is not available" they have an llvm-bolt mode which can also profile the application: If perf record is not available to you, you may collect…
3
votes
0 answers

Clang AST: Unused methods of class templates don't appear in AST

I am working on a source-to-source conversion tool, using Clang's AST via libTooling. There is one problem which I can't seem to workaround. Consider the following C++ code: template struct s { void lazy1() {} void lazy2() {} //…
3
votes
1 answer

Any options that enable loop inversion in LLVM?

Are there any options that enable loop inversion? More specifically,can LLVM transform the while form loop into do-while form loop as the following. Before the transformation, the code is: void foo(unsigned a, unsigned& ret) { bool undone = true; …
shu
  • 31
  • 2
3
votes
2 answers

Can GCC or Clang optimize for call stack memory footprint?

I notice that sometimes compilers keep garbage data in the call stack. Call stack consists of function stack frames, which is the activation record of a function call. Ideally, the stack frame of a function should contain only necessary data,…
Zhiyao
  • 4,152
  • 2
  • 12
  • 21
3
votes
2 answers

Determine LLVM versus GCC at compile time

I'm trying to write a macro similar to the following: #ifndef DEPRECATED_ATTRIBUTE_MESSAGE #define DEPRECATED_ATTRIBUTE_MESSAGE(message) __attribute__((deprecated (message))) #endif And this works, but only with the Apple LLVM 3.0 compiler. It…
Hyperbole
  • 3,917
  • 4
  • 35
  • 54
3
votes
2 answers

How can I create a non-plugin LLVM pass?

I have built LLVM/Clang under Linux, and followed the instructions at http://llvm.org/docs/WritingAnLLVMPass.html to create an LLVM shared object pass plugin. The plugin can then be loaded using LLVM's opt program and the -load switch. Based on the…
user2023370
  • 10,488
  • 6
  • 50
  • 83
3
votes
0 answers

LLVM Profile Error: Runtime and instrumentation version mismatch : expected 4, but get 5

While running the unit tests of our iOS project, we encounter the error I mentioned below. We tried with different iOS versions in XCode 13.4.1 and 14 versions, but the result did not change. Because of this error, Coverage.profdata file cannot be…
3
votes
2 answers

clang: error: '-I-' not supported, please use -iquote instead (Xcode 4)

I'm having this problem building a project using oauth in Xcode. It's a Mac App. Do I have to patch llvm or something? I hope not... Is there anywhere I can set this option in xcode? Thanks!
TRF
  • 43
  • 4
3
votes
3 answers

Notepad++ syntax highlighter for LLVM assembly

Are there any syntax highlighters for LLVM assembly?
Gui Prá
  • 5,559
  • 4
  • 34
  • 59
3
votes
1 answer

Is there any way to use LLVM 3 in Xcode 4.1?

I wonder, since LLVM 3.0 is readily available and officially released, is there a way to compile with LLVM 3 when using Xcode 4.1. It would help alot since I used ARC and my app development turned out to be finished sooner than planned. So I don't…
user387184
  • 10,953
  • 12
  • 77
  • 147
3
votes
1 answer

Couldn't build llvm with gcc on archlinux

I tried to build llvm and got an error message related to stdlib. I searched the cause with error message but I don't know c/c++ well, so I couldn't understand what happened or how to fix this. Please tell me what this means and what happened in my…
rzokok
  • 41
  • 5