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
2 answers

Install llvm-toolset-10.0 or newer in Centos7

I used docker image docker run -ti centos:7 /bin/bash, i try install llvm-toolset-10.0 like this yum install llvm-toolset-10.0 but got error No package llvm-toolset-10.0 available. After that i tried use pre-built binraries from…
Pampastu
  • 83
  • 5
3
votes
1 answer

Can I use Xcode to get the llvm IR?

I have a project which contains both Objective-C and Swift. I want to get the LLVM IR by using Xcode, is there anyway to do that? I try to put -emit-ir into "Other Swift flag", but it doesn't work.
Anditty
  • 61
  • 4
3
votes
2 answers

How to get loopinfo in Module Pass

I want to get loopinfo in each function by iterating through functions in Module Pass. My code is as follows: for (auto &F:M) { if(!F.isDeclaration()){ LoopInfo &LI = getAnalysis(F).getLoopInfo(); } } However,…
gazile
  • 105
  • 6
3
votes
1 answer

Why the optimization, division-by-constant is not implemented in LLVM IR?

According the source code *1 give below and my experiment, LLVM implements a transform that changes the division to multiplication and shift right. In my experiment, this optimization is applied at the backend (because I saw that change on X86…
Shane
  • 337
  • 1
  • 10
3
votes
1 answer

How do I initialize a constant vector in LLVM IR?

I'm trying to initialize a constant vector of ones using LLVM IR as a starting point to familiarize myself with the vector operations supported by various targets. I have the following simple main function defined: target datalayout =…
hatch22
  • 797
  • 6
  • 18
3
votes
1 answer

How do I really disable all rustc optimizations?

I'm trying to learn assembly through compiling Rust. I have found a way to compile Rust code to binary machine code and be able to objdump it to view the assembly. However if I write the following: #![no_main] #[link_section =…
ashleysmithgpu
  • 1,867
  • 20
  • 39
3
votes
2 answers

How to build LLVM source code on Eclipse?

I am trying to add a new pass to the llvm compiler infrastructure. I have been able to build LLVM-2.9 using make.But I wants to build using Eclipse so that I can trace the code. I imported llvm source files to c++ project with LinuxGcc tool…
shashikiran
  • 369
  • 1
  • 5
  • 17
3
votes
0 answers

(MAC M1) ld: library not found for -lomp

I have a problem with the use of libomp and llvm. I tried several solutions but without success. Now I think I'm close to the goal, does anyone have an idea to solve the problem ? This is what my shell returns when I try to compile a file using…
ThéoS
  • 103
  • 1
  • 1
  • 7
3
votes
1 answer

Is there a backend optimizer in LLVM?

I can get the optimization level from the command llc -help -O= - Optimization level. [-O0, -O1, -O2, or -O3] (default = '-O2') I want to know what the optimization does exactly. So, I'm searching the source code of the backend…
Shane
  • 337
  • 1
  • 10
3
votes
1 answer

Is there a way to disable #warning in LLVM GCC 4.2 from causing a warning in certain Targets

I'm looking for a compliler flag to disable the GCC #warning directive in Debug targets but not release targets. Does anyone know of a way to do this?
Matthew Bischoff
  • 1,043
  • 11
  • 27
3
votes
2 answers

Apple LLVM compiler -- use pragmas to inhibit all warnings for a portion of a file?

I need inhibit warnings for part of one of my source files. This is what I have. It's not working. #pragma GCC diagnostic push #pragma GCC "-w" // also tried "-Wall" // code that generates warnings here #pragma GCC diagnostic pop
William Jockusch
  • 26,513
  • 49
  • 182
  • 323
3
votes
1 answer

LLVM linker places stack in the wrong place

I am trying to link Cortex-M4 firmware with clang + lld. The gcc build works fine. I am using the stock CMSIS linker script with only RAM & ROM size adjusted (bases are the same). Beginning of the script (without comments): __ROM_BASE =…
filo
  • 223
  • 3
  • 14
3
votes
1 answer

How to access map element using lldb?

Compile the snippet with clang++ -std=c++17 -g source.cpp #include #include int main() { std::map m; m["foo"] = 23; } Try to access the element with key foo, but have errors: * thread #1, queue =…
amordo
  • 449
  • 5
  • 15
3
votes
1 answer

How to force llvm cmake to use only given path to libs?

I try to build llvm on a system where I have no root access. So, I've got some problems: I have been obliged to install gcc, cmake in my $HOME path because system's gcc and cmake are very old and I cannot update them with sudo. I finely installed…
MadMax
  • 41
  • 4
3
votes
2 answers

RISC-V Toolchain with Vector support

I am looking for a C/C++ toolchain that supports the RISC-V vector extension v1.0 as defined per official spec. Spike appears to support vector rvv1.0, but I am having trouble finding a toolchain to use it with. Neither GCC (I only see a branch for…
Fabian
  • 312
  • 3
  • 13
1 2 3
99
100