llvm-ir Questions

2

Solved

I'm working on verifying some Rust code using SAW. SAW requires that you compile to LLVM bitcode, which you can then import and verify. I know you can generate bitcode using the --emit=llvm-bc flag...
Riband asked 3/9, 2021 at 8:48

2

Solved

How to determine all global variables of a LLVM module? I want to modify them using a module pass.
File asked 6/3, 2017 at 8:46

2

I am trying to understand the LLVM IR generated from a C++ program int add(int *x); int func() { int T; T=25; return add(&T); } The generated IR is: define i32 @_Z4funcv() local_unnamed...
Hamm asked 28/8, 2018 at 19:8

1

I am trying to add my llvm pass into Rustc. Rustc has one compiling option -C passes=val where we could add extra LLVM passes to run. However, as my try, this option can only accept the pass when t...
Fording asked 1/11, 2022 at 4:0

1

Solved

I'm generating LLVM IR for JIT purposes, and I notice that LLVM's calling conventions don't seem to match the C calling conventions when aggregate values are involved. For instance, when I declare ...
Repine asked 11/9, 2016 at 16:4

1

Solved

mem2reg is an important optimization pass in llvm. I want to understand how this optimization works but didn't find good articles, books, tutorials and similar. I found these two links: broken or ...
Garton asked 3/9, 2022 at 13:6

4

I would like to step through some LLVM IR code I have generated. The code is syntactically and type valid as far as the llc and lli are concerned, but the results are not what I expected. The chu...
Shevat asked 13/8, 2015 at 9:33

3

Solved

LLVM has phi instruction with quite weird explanation: The 'phi' instruction is used to implement the φ node in the SSA graph representing the function. Typically it is used to implement branchin...
Jetty asked 14/7, 2012 at 16:42

2

Solved

Here is a quick question on analyzing LLVM IR. So basically I am trying to fetch the return value of the LLVM IR function call statement, something like this: %47 = call i256 @test(i256 %46) I w...
Overcautious asked 25/3, 2019 at 16:12

2

I want to copy these set of instructions from one part and paste to that in another part in IR %0 = load i32, i32* @x, align 4 %1 = load i32, i32* @y, align 4 %add = add nsw i32 %0, %1 %2 = lo...
Pulcheria asked 9/4, 2017 at 7:1

2

I build a simple application: hello.c #include <stdio.h> void foo(int x) { printf("%d", x); } int main() { printf("Hello\n"); foo(6+5); return 0; } With an LLVM IR...
Etti asked 24/4, 2021 at 8:34

3

I would really like to use swift for embedded programming as I feel like its a much better replacement for c++, The processor I'm using is an ARM Cortex-M4F(http://www.ti.com/tool/ek-tm4c123gxl). L...
Luisaluise asked 19/12, 2015 at 18:12

4

Solved

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 point...
Featherbrain asked 14/10, 2011 at 20:25

2

Solved

I am looking for a right way to get a next immediate instruction that follows a given instruction. Let's assume that I have the following: %10 = icmp slt i32 %8, %9 br i1 %10, label %11, label %1...
Owenism asked 17/5, 2017 at 20:27

2

I want to design a IR (like LLVM IR) for my toy compiler and I don't know what is the purpose of the alloca instruction in further analysis. In which optimizations alloca informations are used?
Rim asked 4/8, 2017 at 12:49

1

Solved

What is the correct way to create a raw_ostream object and use it for printing? I read various articles and the only example I can find is (How to redirect llvm::outs() to file?) raw_ostream *outpu...
Arnone asked 25/11, 2020 at 7:40

3

Solved

I'm developing a compiler for a new language of mine in LLVM and have run into an issue while generating debug information. I have not yet found much documentation on how to actually generate the d...
Nicotine asked 12/12, 2015 at 3:48

2

I have been using the headers provided in include\llvm and include\llvm-c to try and make my own compiler. However, whenever I try to compile, I get this error. There is no llvm/IR/Attributes.inc i...
Longanimity asked 4/12, 2018 at 14:50

2

Solved

I am trying to get LLVM IR for a file which is linked with some static libararies. I tried to link using llvm-link . It just copy the .bc files in one file ( not like native linking). clang -L$(T_L...
Treasury asked 12/10, 2020 at 22:17

1

What does comdat in LLVM represents? You can find the source here:Comdata An example from source level program representation (c++) would be very much helpful. If you need more info, please feel fr...
Czernowitz asked 19/4, 2019 at 20:45

2

Solved

For the following branch instruction br i1 %cmp, label %if.then, label %if.end, !dbg !35 Since llvm is SSA, I can directly access the operand 0, to determine whether the comparison is true or not....
Religieux asked 11/9, 2020 at 7:52

1

What is the "correct" (i.e., portable) way in LLVM to load data from memory into a SIMD vector? Looking at the typical IR generated by LLVM's auto-vectorizer for an x86 target, it seems l...
Springclean asked 25/7, 2020 at 15:36

1

Solved

For example, I have a C code: void foo(int x) { int y; if (x > 0) { y = 1; } else { y = 2; } // do something with y } To simplify this code in LLVM IR level (where y can be put in the re...
Heptastich asked 23/7, 2020 at 6:42

5

Solved

For writing a compiler, what are the advantages and disadvantages of using LLVM IR vs C for a target language? I know both are used, and I imagine that the final machine code would be similar if I ...
Krisha asked 22/4, 2012 at 2:8

2

Solved

I'm fully aware that a similar question was already asked here: Generating LLVM Code from Java The thing is, that was in 2012...I looked at the solutions and found most of the projects menti...
Kelleekelleher asked 14/9, 2016 at 9:31

© 2022 - 2024 — McMap. All rights reserved.