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.

Filter by
Sorted by
Tagged with
1 vote
0 answers
13 views

How to define the special member functions that should be implicitly-defined in Clang LibTooling

I've been working on a Clang Tool that aims to generate the implicitly-declared and implicitly-defined special member functions. I get the Clang AST, and I found that Clang does not always declare/...
GKxx's user avatar
  • 137
0 votes
0 answers
19 views

How to build a bare metal app for aarch64 using LLVM?

I am trying to understand how I can compile and link a bare metal app using LLVM (macOS). loader.s: .global _reset _reset: # Set up stack pointer LDR X2, =stack_top MOV SP, X2 # Magic ...
Denis Sologub's user avatar
-1 votes
0 answers
28 views

'stop_token' file not found using libc++ and llvm 16

I'm trying to compile the following program: #include <stop_token> int main() { std::stop_token token; return 0; } With clang++ -o bin -stdlib=libc++ -std=c++20 ex2.cpp $ clang++ --...
yonutix's user avatar
  • 1,998
1 vote
1 answer
31 views

Apple M1 install LLVM version 9

CONTEXT: I am trying to install a plugin within QGIS. The plugin requires many python packages which I am installing via pip3. One of the packages being LLVMLITE at version 0.33.0. My MacOS is Ventura ...
charlie090's user avatar
0 votes
0 answers
33 views

How to solve "fatal error: clang/Frontend/LangStandard.h: No such file or directory"

I am trying to install the code of this git repo. I follow the instructions in its README file, but during the make command, I always get this error: pet.cc:73:10: fatal error: clang/Frontend/...
BR8's user avatar
  • 1
0 votes
0 answers
12 views

Debug the LLVM installed in my machine to know about the conversion from IR to Machine code

I wanted to learn how LLVM translate IR into machine code of specific target. How the mapping is done? I wanted to go into debug mode and debug any c++ files of LLVM. But I don't know whether it is ...
Ayush Singh's user avatar
0 votes
0 answers
16 views

How to make llvm ir file in visual studio

By changing to llvm target, an exe file is created, but I want to create an ir file, which is an intermediate file.
bam's user avatar
  • 5
-1 votes
1 answer
31 views

Which LLVM release will contain the specific issue closed on GitHub?

For instance, there is a recently closed issue on LLVM GitHub repository related to clang-format. Question about the issue was posted on Stack Overflow as well: Leave short lambda used as a middle ...
αλεχολυτ's user avatar
0 votes
0 answers
40 views

Compiling assembly (.s file) using gcc error c++ standard library

I am trying to compile an .s file I produced using llvm (llc) back to an .exe file. When trying to compile the .s file using g++ with g++ output.s -o test.exe, I get multiple errors of output.s:344: ...
kevl's user avatar
  • 9
0 votes
0 answers
22 views

Fix "clang: error: unsupported option '-fopenmp'" when building from source

I am currently working on something for which I need to use an application that I can only build from source (namely the MiBS solver) When I do as described in the provided readme, I encounter this ...
Leon Zimmermann's user avatar
0 votes
0 answers
30 views

How to change llvm version for m1 Mac to build Haskell project

I am trying to build a Haskell project but I keep getting this error: You are using an unsupported version of LLVM! Currently only 9 to 13 is supported. System LLVM version: 15.0.7 We will try ...
callum arul's user avatar
0 votes
1 answer
23 views

Does clang have function attribute: unroll loop like gcc?

Like title, I know clang have statement attribute #pragma clang loop unroll(enable) https://clang.llvm.org/docs/LanguageExtensions.html#extensions-for-loop-hint-optimizations , gcc's like ...
hstk's user avatar
  • 165
3 votes
1 answer
51 views

How to use native popcount with numba

I am using numba 0.57.1 and I would like to exploit the native CPU popcount in my code. My existing code is too slow as I need to run it hundreds of millions of times. Here is a MWE: import numba as ...
Simd's user avatar
  • 19.7k
0 votes
1 answer
16 views

LLDB pass bash command output as arg to application

I am trying to debug a program using lldb and I want to start the program with different arguments. Is it possible to pass the output of a bash command to a program when you start it in lldb? As an ...
John554's user avatar
  • 145
0 votes
0 answers
7 views

How does OrcJIT or MCJIT implement function-level parallel compilation on a huge module?

I have a huge module with about 800 functions in it. Now I want to use MCJIT or OrcJIT for multi-thread compilation. I plan to use 8 worker threads and compile 100 functions per thread. But I found ...
ApsarasX's user avatar
0 votes
0 answers
80 views

LLVM pointers dereference

In my main function, I have allocated an i8 pointer: %a = alloca i8*, align 8 store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @1, i32 0, i32 0), i8** %a, align 8 Is it possible to: assign a ...
Kellan_B's user avatar
1 vote
1 answer
51 views

Building LLVM for IPU

I'm trying to install LLVM for IPU. I tried to build as it is usually done for the chosen architecture cmake -S llvm -B build -G Ninja -DCMAKE_INSTALL_PREFIX=../install_llvm/ -DLLVM_TARGETS_TO_BUILD=&...
sofokl's user avatar
  • 13
0 votes
1 answer
75 views

Creating a pass that would insert a print statement of each basic block in LLVM

Hi I am trying to create a LLVM pass that would insert a print statement of its basic block names when it traverses them. I have been facing this run time error and I do not know how to address it. #...
Yuta Nakamura's user avatar
0 votes
0 answers
10 views

How to find forOp arg's preOp in MLIR

%39 = tt.addptr %38, %37 : tensor<32x64x!tt.ptr<f16>>, tensor<32x64xi32> %40 = tt.expand_dims %30 {axis = 1 : i32} : (tensor<64xi32>) -> tensor<64x1xi32> %41 = ...
Bean's user avatar
  • 3
0 votes
1 answer
61 views

Declare string type for parameter in LLVM

How would I declare a string parameter in the LLVM C++ API? For example, to declare a double parameter, I would do this: argTypes.push_back(Type::getDoubleTy(*context)) Is it possible to do this for ...
Kellan_B's user avatar
1 vote
0 answers
47 views

Storing a struct as a blob of data breaks with some optimization passes

I'm writing a compiler with LLVM as backend. Recently I turned on the optimizations, and saw my programs break in strange ways. I managed to boil things down to a minimal code, and set of optimization ...
Xavier's user avatar
  • 102
1 vote
1 answer
32 views

How to get noexcept-ness of a FunctionDecl in clang?

I'm currently implementing a clang tool. I have no idea how to find out the noexcept-ness of a function given its clang::FunctionDecl. For the following code struct X { X() = default; }; int main() ...
GKxx's user avatar
  • 137
0 votes
1 answer
26 views

Usage of LLVM DependenceAnalysis Pass

For my own LLVM pass I need the results of the llvm::DependenceAnalysis() pass. I.e. I want the DependenceInfo object for some module/function. I tried several approaches to get the pass to run the ...
christbl's user avatar
0 votes
0 answers
41 views

Build the LLVM-IR Code with AddressSanitizer Pass using opt command

I have some question about the building process with AddressSanitizer using opt. I want to build the LLVM-IR Code(.ll) using opt command with specific LLVM Pass like AddressSanitizer(asan). To do this,...
MJUCOM's user avatar
  • 1
2 votes
0 answers
56 views

24-bit Custom Target

I'm trying to compile for a custom target that has a 24-bit pointer (the eZ80). I'm now stuck wondering if that's even possible in the current Rust toolchain? I tried creating a custom target file ...
Kestrel's user avatar
  • 23
1 vote
1 answer
15 views

Numba: LLVM IR parsing error when trying to access elements in a typed list of jitted functions

I'm encountering an issue with Numba when trying to access elements in a typed list of jitted functions. The error message I receive is an "LLVM IR parsing error" with the line ret i8* null. ...
Dmitry Naumov's user avatar
1 vote
0 answers
32 views

is there a way to store arm64 assembly code in module using LLVM API?

I'm currently working on a compiler project using llvm. I have IR Module , But I want function which takes IR module as argument and return Assembly module of TARGET(ARM64 or aarch64). .My goal is to ...
Ayush Singh's user avatar
1 vote
1 answer
53 views

Macro to check if I am running MSVC or Intel compiler

I am using the newest Visual Studio 2022 and also installed the Intel C++ compiler. When I just write a simple main() to print the values of the macros MSC_VER and __INTEL_LLVM_COMPILER, I get ...
ijklr's user avatar
  • 145
-2 votes
0 answers
25 views

How to Compile External API Calls

I am planning to create an LLVM frontend compiler that converts JS code into LLVM IR. However, the JS code contains calls to external APIs that I've developed in C or C++. These APIs have a JavaScript ...
qorz's user avatar
  • 1
1 vote
0 answers
37 views

Compiling a program that uses PassManagerBuilder with LLVM 17

It appears LLVM has removed PassManagerBuilder.h now that they have upgraded to LLVM-17. There is a program that I would like to compile that uses PassManagerBuilder.h. Is there a way to compile it ...
John213214214's user avatar
0 votes
1 answer
25 views

Linker Errors when Building Shared Library with LLVM and C++

I'm working on a project where I'm trying to build a shared library using C++ and LLVM. The goal is to generate LLVM IR from an Abstract Syntax Tree (AST) representation of a programming language. ...
KAGE's user avatar
  • 1
0 votes
1 answer
33 views

Explaining LLVM for loop

I am following along this post however I am new to C++ and LLVM and need help breaking down what everything means in this for loop for(auto I = inst_begin(F), E = inst_end(F); I != E; ++I) { ...
corkeygo's user avatar
1 vote
0 answers
39 views

Clang format stop operators aligning on wrap

clang-format is formatting like this: std::ostream& operator<<( std::ostream& os, const Camera& c ) { return os << c.latitude << ", " << c.longitude &...
Aidan's user avatar
  • 413
1 vote
1 answer
26 views

Is it possible to relocate MergedGlobals to specific bss/data regions?

I am using the MPU to grant access to specific regions of memory. (Target is a microcontroller + zephyr-rtos, rust compiled as a static lib). The app crashes with an MPU Fault. I have traced the ...
Marius's user avatar
  • 400
0 votes
1 answer
11 views

Clang Analysis CFG loop identification finds the while loop but fails to print the associated code fragment and line number

I am trying to use Clang to find all the loops at the source code level of an input source file. My code currently can identify for-loops in the source file and printout the line number. It also seems ...
Kokoro's user avatar
  • 1
1 vote
0 answers
50 views

Is it possible to call C functions from within LLVM JIT-compiled functions?

I'm trying to call one or more precompiled C functions from within one or more LLVM JIT-compiled functions. (When I say "precompiled" here, I just mean that the function is in my source ...
SocraticMathTutor's user avatar
0 votes
0 answers
40 views

ninja build does not pick flags while running build

I am trying to build llvm code (https://github.com/llvm/llvm-project.git) using cmake with Ninja generator. So basically as a first step i am configuring cmake with Ninja generator :- cmake configure ...
vam's user avatar
  • 21
0 votes
0 answers
22 views

How to perform data flow analysis on function parameters in IR

enter image description here How to determine whether a GEP instruction, when accessing a structure member, originates directly or indirectly from a function parameter? What I think of is the ...
Vie's user avatar
  • 3
0 votes
1 answer
27 views

GCC, GDC, and LLVM and LDC compilers’ prefetch builtins - exact meaning of the locality parameter

In the description of the x86 prefetch instructions, I found the following explanation for the instructions’ hint number "Fetches the line of data from memory that contains the byte specified ...
Cecil Ward's user avatar
0 votes
1 answer
48 views

How to build libclang_rt.builtins.a?

I'm trying to build Chromium, and I get an error that the file libclang_rt.builtins.a is missing. It seems that this file is a static library that is part of compiler-rt, so it should be getting ...
Brian Bi's user avatar
  • 112k
2 votes
1 answer
54 views

How to find SourceLocation of the outer template parameter list of a class template member function definition?

I am working on a Clang AST generated from the following source code: template<class T> struct my_class { template<class U> void foo(U arg); }; template<class V> template<...
Jared Hoberock's user avatar
0 votes
1 answer
38 views

GCC not standard / non-conforming optimization flags?

I'm looking for compiler optimization flags that disregard standards compliance to produce better performing/smaller binaries. Thus far I found: -ffast-math -fno-math-errno -funsafe-math-...
vfjpl's user avatar
  • 11
0 votes
1 answer
27 views

how to modify the operand in this IR

%1 = load i32, i32* getelementptr inbounds (%struct.A, %struct.A* @g_a, i64 0, i32 1, i32 2), align 4, !tbaa !10 I want to change the number from i64 0, i32 1, i32 2 to i64 0, i32 0, i32 1 first I get ...
Vie's user avatar
  • 3
4 votes
0 answers
234 views

Using LLVM-based tools (clang, Rust, Zig) to compile for N64

I’m trying to use the LLVM-based zig cc to compile C code (and eventually other LLVM-based languages like Rust/Zig) for the R4300i / VR4300 MIPS CPU, which is the processor in the N64. But I don't see ...
CrepeGoat's user avatar
  • 2,335
0 votes
1 answer
34 views

What is the simplest instruction set with a current supported toolchain? [closed]

I am planning as an exercise to learn Verilog to implement a CPU core. As this is my first time doing it, I am wondering what would be the simplest CPU architecture with a currently supported ...
Fred Helmers's user avatar
0 votes
0 answers
40 views

Cross-compiling a loadable kernel module for Android

I'm trying to install the LiME tool for memory dumps in Android. LiME is implemented through a loadable kernel module, which, as I understand, forces me to prepare and compile the kernel for it. Their ...
Gabriel Rebello's user avatar
0 votes
0 answers
23 views

Integrating Custom build of clang-tidy in CodeChecker

I successfully installed CodeChecker (https://codechecker.readthedocs.io/en/latest/#install-guide). The check and analyze commands that CodeChecker provided work on my input files. Now, my task is to ...
Nachiket Deo's user avatar
2 votes
1 answer
44 views

In LLVM, can you specify that two different code paths will produce the same result?

I'm writing a C library for an embedded platform, and the platform's firmware has several routines for character output. One of the subroutines is general purpose - you load the ASCII character you ...
TheHans255's user avatar
  • 2,059
1 vote
1 answer
46 views

Is there a way to insert pre-written LLVM IR into a module

I am working on a compiler, and my language requires that some functions are already implemented and available. For example, if I wanted to implement a stack in my language (software) I would use the ...
Rajesh's user avatar
  • 13
0 votes
1 answer
38 views

How to make clang-format not break after = signs and not BinPackArguments

I'm using clang-format with a small configuration file, based on the Microsoft style. --- BasedOnStyle: Microsoft BinPackParameters: 'false' BinPackArguments: 'false' ColumnLimit: '120' #Other options....
Bob from IT's user avatar

1
2 3 4 5
129