Skip to main content
Filter by
Sorted by
Tagged with
Advice
0 votes
1 replies
43 views

I wanna make a function starting with a function prototype as usual in the LLVM C++ API and I want one of the accepted arguments of the function to be a char*. Can someone guide me on how I can do ...
Jordon's user avatar
  • 103
0 votes
1 answer
93 views

The LLVM Programmers Manual gives some brief idea of how llvm::cast works: cast<>: The cast<> operator is a “checked cast” operation. It converts a pointer or reference from a base class ...
Aleksandr Medvedev's user avatar
3 votes
1 answer
137 views

I write a compiler that generates LLVM IR code and then .obj file. Then I link it with some required .lib files. (msvcrt.lib, ucrt.lib, vcruntime.lib). I declared setjmp and longjmp there as follows: ...
crackanddie's user avatar
0 votes
1 answer
43 views

Consider the example of llvm-IR code: define void @f( i32* %pa, i32 %b) { bb0: call void @g() %a0 = load i32, i32* %pa %p0 = icmp slt i32 %a0, %b br i1 %p1, label %bb1, label %bb2 bb1: call ...
Павел's user avatar
0 votes
0 answers
67 views

I am not sure whether this is the correct category/group to ask this question. I see that there is a way to map an op to external function: https://mlir.llvm.org/docs/Dialects/Linalg/ Property 5: May ...
knightyangpku's user avatar
4 votes
2 answers
311 views

I'm writing a compiler in Rust using the llvm-ir crate but it only supports up to LLVM 19. I need to compile Rust's LLVM IR output using my compiler. But running rustc --version --verbose outputs the ...
TheGoldenTree's user avatar
0 votes
0 answers
31 views

I'm trying to develop a custom LLVM obfuscation pass using the new PassManager (NPM) infrastructure. In my pass, I need to access TargetIRAnalysis (or TargetTransformInfo) by calling getResult(F). ...
Tài Lê Đức's user avatar
0 votes
0 answers
115 views

I am currently trying to build an operation for matrix multiplication in my custom MLIR dialect. I've declared the operation in a .td file and I mean for it to handle two sets of variadic inputs but I ...
Yoocee Ansah's user avatar
0 votes
0 answers
41 views

I am new to LLVM, and I am using LLVM as the backend to my own compiler. Suppose I have the following struct type and a function: // a POD struct type struct type_fp32 { float a; float b; ...
Enigmatisms's user avatar
0 votes
0 answers
46 views

I am implementing an LLVM pass for anticipated expressions using dataflow analysis and code hoisting. The reference I am following is the Purple Dragon Book (Compilers: Principles, Techniques, and ...
Abhishek Ghosh's user avatar
0 votes
0 answers
71 views

I am new to compiler and llvm, and I am sorry if my question or approach is kinda odd... Following is the example machine code: bb.0.entry: successors: %bb.1(0x50000000), %bb.5(0x30000000); %bb.1(62....
Jinlock's user avatar
0 votes
1 answer
56 views

By definition, top-level variables are those that cannot be referenced indirectly via a pointer, i.e., those whose address is never exposed via the address of operator or returned via a dynamic memory ...
heturing's user avatar
  • 352
0 votes
1 answer
29 views

Here is my implementation of fib on LLVM-IR, everything work fine under i64 limit, but above that, it can't printf the correct result, even with attempt to truncate i128 into 2 halves of i64 : define ...
user avatar
2 votes
0 answers
118 views

I'm trying to convert an i32 (integer) to an i8 pointer (string) by creating a buffer and adding to it using sprintf like in C. However, this does not work because I get an error saying that sprintf ...
user29006542's user avatar
2 votes
0 answers
93 views

I currently have a compiler where I use the legacy FunctionPassManager. My code for this is essentially identical to the Kaleidoscope implementation here: https://llvm.org/docs/tutorial/BuildingAJIT2....
ngbv2128's user avatar
1 vote
1 answer
55 views

I'm currently making a compiler that outputs bare LLVM-IR instructions and implementing variadic function calls. I have defined a println function that accepts a (format) string and variable amount of ...
johron's user avatar
  • 13
0 votes
0 answers
154 views

I'm learning LLVM IR and noticed some seemingly redundant instructions in the generated code. For example, in the following LLVM IR: define i32 @main() #0 { %1 = alloca i32, align 4 store i32 0, ...
crimsnow's user avatar
0 votes
1 answer
132 views

I'm currently working on programming language compiler that generated LLVM-IR. I'm not using any library for the emitting, so I'm just writing instructions to a file. The problem is mutable variables, ...
johron's user avatar
  • 13
0 votes
0 answers
166 views

I have written a compiler pass, which needs to change IR, and I want to use it in Clang. It works well when I use: opt -load=/home/yyb/Desktop/test/libinsertca.so -passes=Insertca -S test.ll -o test2....
yibo yuan's user avatar
1 vote
0 answers
160 views

Generated by compiler I'm adding debug info to a go compiller (github.com/goplus/llgo) that used LLVM as backend, it passed in most cases, excludes a few simple cases likes below: func ...
Jacky Lee's user avatar
  • 1,374
2 votes
0 answers
130 views

I have exported Rust code to a LLVM-IR (.ll) file and was able to compile and link it manually using both, clang and llc + link.exe. It required to link against a lot of system libraries, Rust ...
Remodor's user avatar
  • 21
0 votes
1 answer
204 views

There's an old project which needs to redefine symbol in build progress. I want to enable -flto, but it seems unable to redefine symbol now. echo "int foo(){return 0;}" > foo.c clang -c ...
kkocdko's user avatar
  • 428
0 votes
1 answer
84 views

I am currently in the middle of building my first compiler in python. I have completed the lexer, parser and analyzer. I was planning on using the llvmlite library to emit ir. I am having trouble ...
abdullah mohsin's user avatar
1 vote
0 answers
78 views

Hi I have the following IR, I would like to get either ConstantFP or ConstantFPSDNode on the operand of this foo ( SDNode ) here's what I see in gdb, I see that this float value is not lowered to a ...
Pawan Nirpal's user avatar
1 vote
0 answers
145 views

I have a simple scalar instruction which I added to LLVM, which takes two inputs from GPR and writes the output also to GPR. I can compile C code using inline assembly for the new instruction. I would ...
Vadim Kustov's user avatar
0 votes
1 answer
210 views

I am currently expanding a RISC-V core with a custom load instruction. For this question, the specifics are unimportant. It functionally behaves like a normal load instruction and should use the same ...
Florian S.'s user avatar
0 votes
0 answers
36 views

I'm developing an LLVM pass to quantize a function by changing its return type from float to int32. Specifically, I have a function called mulfix with the following definition: define dso_local float ...
Alex Xia's user avatar
0 votes
0 answers
60 views

I want to use LLVM to JIT compile some code in my game using the LLVM C/C++ API. The JIT compiled functions should be able to effect the physics of the world, which is handled by bullet3. To do so I ...
Lessthan314's user avatar
1 vote
0 answers
46 views

Context: I am trying to find out the depth between two CFGs using BFS but the code is not properly working as it's only showing the results up to depth 0 and 1 but it's not showing the other depths ...
tamanna's user avatar
  • 11
6 votes
3 answers
484 views

I want to write a numba function that takes the sum of an array of np.float128s. These have 80 bits of precision on my set up but if it is easier to cast them to real float128s I would be happy with ...
Simd's user avatar
  • 21.5k
0 votes
1 answer
53 views

So I have this LLVM-IR code: ; ModuleID = 'example.-.input.c' source_filename = "example.-.input.c" define ptr @test() { entry: %0 = alloca ptr, align 8 %1 = alloca i32, align 4 store ...
user15137953's user avatar
0 votes
0 answers
53 views

I'm new to LLVM Backend development and I'm discovering some of its working by modifying an existing backend, compiling the llvm-project and observing the changes brought to the binaries and their ...
Ilyass's user avatar
  • 1
0 votes
1 answer
190 views

I want to know how LLVM IR can be converted t other intermediate representations. I know that using llc -march=wasm32 -filetype=asm arithmetic.ll -o example.wat one can convert LLVM IR to the WASM IR ...
Aditya Anand's user avatar
0 votes
1 answer
771 views

I am trying to write my first ever compiler in C using LLVM for its backend, but I get an error when I try to run it. I have not found anything about this exact error message on other places. Here is ...
SzAkos04's user avatar
1 vote
1 answer
412 views

According to llvm opaque pointer documentation, only opaque pointer will be supported since LLVM 17, which means it is no longer possible to get the pointer level (e.g., i8* is 1 and i8*** is 3) by ...
heturing's user avatar
  • 352
0 votes
2 answers
274 views

I am using LLVM 15 and I am trying to compile a language of my own (pretty much like Pascal in terms of syntax) to LLVM IR and I am using Ocaml. When I try to create a struct and set its body to have ...
lil_papa's user avatar
1 vote
0 answers
78 views

I am trying to run the llvm InstCount pass in the new pass manager on a random generated c code. I generated a .bc file from the c file , using command : /usr/bin/clang -I/home/intern24001/csmith/...
Anik Basu Bhaumik's user avatar
1 vote
0 answers
65 views

I am new to llvm. I am trying to figure out all store instructions which may change the memory a given pointer points to, using the Basic-aa pass that llvm provides. However, when I run my code, it ...
JadeFish's user avatar
0 votes
1 answer
278 views

I want to model dynamic arrays. This is the plan i've come up with: there will be a base struct for all my arrays, including a vtable-pointer, and also the runtime-size of the array: %anyarray_base = ...
marstato's user avatar
  • 365
0 votes
1 answer
55 views

Now I am trying to develop a compiler.I want a "print" function.It can be used like this: print(90, "hello world") Before,I use a list(or vector) to hold the arguments.But now I ...
limuy's user avatar
  • 21
0 votes
0 answers
180 views

I am trying to implement a pass that will answer queries like isAlive(var,n) where n is a basic block and var is any SSA variable. isAlive returns true if var is alive in the basic block n. From what ...
lava_07's user avatar
  • 93
2 votes
0 answers
120 views

I am trying to use Spoq framework (and on GitHub) to translate code from C to Coq. I faced problem - I am getting only low-level specifications for my functions (just AST), but I want to get high-...
Natasha Klaus's user avatar
0 votes
1 answer
153 views

I am currently studying LLVM. And I am following《LLVM Essentials》。In “Creating an LLVM Moudle” There is something as: static llvm::LLVMContext context; Module *module = new Module("Module",...
Valerian's user avatar
0 votes
1 answer
710 views

I am working with LLVM to build a small compiler in Rust using inkwell (inkwell uses llvm-sys, so it is relevant to it too). First of all, compiled windows binaries on llvm's github do not include ...
MORAS's user avatar
  • 31
0 votes
0 answers
404 views

I just start learning LLVM and follow the start-up website quick-start-writing-hello-world to write my first HelloPass. However, it doesn't work as expected. The llvm version is 16.0.6 Here are my ...
Hardy's user avatar
  • 1
0 votes
1 answer
237 views

EDIT: I got it working by using ld -o output main.o -L /lib/gcc/x86_64-linux-gnu /lib/x86_64-linux-gnu/crti.o /lib/x86_64-linux-gnu/crtn.o /lib/x86_64-linux-gnu/crt1.o -dynamic-linker /lib64/ld-linux-...
user15137953's user avatar
0 votes
0 answers
74 views

I'm trying to insert splitblock at start of a function in function pass?? Trying this results in losing stack optimization done through PrologEpilog pass on entry block. This seem to be because of ...
user22870953's user avatar
0 votes
0 answers
28 views

While experimenting with LLVM I've run into a segmentation fault that I don't fully understand. For simplicity, I'm trying to allocate a chunk of memory as a large integer, and then using ...
Eric D's user avatar
  • 141
0 votes
1 answer
66 views

I am currently writing my own compiler using Rust and LLVM and therefore, the LLVM-C-API. For Debugging purposes, the LLVM-C-API provides a Function called LLVMDumpModule(). Sadly, this seems to ...
Jonas's user avatar
  • 75
1 vote
1 answer
227 views

Given such an example named TestCase1.ll: ; RUN: opt -load-pass-plugin=%dylibdir/libLocalOpts.so \ ; RUN: -p=algebraic-identity,strength-reduction,multi-inst-opt \ ; RUN: -S %s -o %basename_t ;...
Picassso's user avatar

1
2 3 4 5
26