llvm-ir Questions

1

I recently installed LLVM 7, and tried to include the necessary files to start a project using llvm library in CLion. However, it complains that some files are not found. My CMakeLists.txt file h...
Satirize asked 5/2, 2019 at 15:40

1

When using a C++ compiler with LLVM version 6.0.0, the following code bool isEven(int n) { bool ret = true; for (int i = 0; i < n; i ++) { ret = !ret; } return ret; } emits the LLVM IR ...
Adigun asked 28/2, 2020 at 17:57

1

Solved

I am trying to retrieve the name of the pointer passed to a cudaMalloc call. CallInst *CUMallocCI = ... ; // CI of cudaMalloc call Value *Ptr = CUMallocCI->getOperand(0); if (AllocaInst *AI = d...
Scotty asked 25/12, 2019 at 14:13

1

Solved

I can get llvm-ir from C code using Clang. I just want to work with LLVM-IR. For my compiler project. I need to convert LLVM-IR to target machine code or executable. But I can't convert LLVM-IR to...
Messina asked 3/12, 2019 at 8:51

1

Background (there may be a better way to do this): I am developing a Julia library in which I manually manage memory; I mmap a large block, and then mostly treat it like a stack: functions receive ...
Surmise asked 13/11, 2019 at 16:16

2

I have created a function in LLVM IR. Now I want to create a return instruction return void. I saw the function Create ReturnInst::(LLVMContext &C, Value *retVal, BasicBlock *InsertAtEnd) But...
Veto asked 15/11, 2014 at 17:43

1

How do I run a non-legacy PassManager? I have tried doing the following but there is some exception thrown when trying to invalidate the analysis manager in the run function. Is there something els...
Henninger asked 31/7, 2017 at 8:27

0

I would like to generate a fully linked LLVM bitcode file from Rust source code which could be executed by LLVM IR interpreters such as lli. I found solutions such as one from Reddit and another on...
Goon asked 11/6, 2019 at 18:20

1

Solved

I'm creating a statically compiled programming language, and I'm using LLVM as its backend. I want my language to trap/crash whenever integer overflow occurs. I'm aware of things like llvm.sadd.wi...
Valorous asked 16/5, 2019 at 22:24

1

I am trying to write an LLVM backend for my custom processor that I have designed recently. I tried to follow the official tutorial at http://llvm.org/docs/WritingAnLLVMBackend.html But it ...
Riven asked 9/10, 2016 at 17:28

1

I'm a newbie in llvm, and I'm trying to find all the function call instructions in IR. My code is shown below: for (BasicBlock &BB : F) { for (Instruction &inst : BB) { errs() <&lt...
Gruver asked 31/3, 2019 at 4:30

1

how to use LLVM UserOp1? I can't find any examples of this instruction.
Phosphorism asked 30/3, 2019 at 9:41

1

Let's say I want manually turn code below to IR code: #include <stdio.h> int main() { int (*p)(const char *__s); // how to implement this? p = puts; // and this? p("Hello World!\n"); } ...
Skateboard asked 27/2, 2019 at 12:12

1

I'm writing a toy compiler and want my language support virtual methods, but I have no idea how to do it, it seems not as straight forward as other statements which can be easily turn into the IR c...
Binding asked 26/2, 2019 at 6:54

4

Solved

The operands for an llvm::User (e.g. instruction) are llvm::Values. After the mem2reg pass, variables are in SSA form, and their names as corresponding to the original source code are lost. Value:...
Grayback asked 28/1, 2014 at 16:3

2

I generate ir by use 'clang -S -emit-llvm test.c'. int main(int argc, char **argv) { int* a=0; a=(int *)malloc(sizeof(int)); printf("hello world\n"); return 0; } and this is the ir: define ...
Cand asked 20/5, 2018 at 8:24

1

(This happened while doing the fix I found here: LLVM IR: expose variables to GDB?) I am trying to compile some code written in a custom programming language. It is compiled to LLVM IR, and then ...
Sancho asked 28/11, 2018 at 21:51

0

I am trying to compile a LLVM IR file. However, when I try to compile it, I get this stack trace: warning: overriding the module target triple with x86_64-pc-linux-gnu [-Woverride-module] #0 0x000...
Signorino asked 7/1, 2019 at 20:40

0

I am writing a custom programming language. I am generating LLVM IR as an intermediate (via LLVMlite), and I want to expose variables to GDB. This is an example of the generated IR: ; ModuleID =...
Genotype asked 27/11, 2018 at 22:7

1

The LLVM IR doc discusses the IR in detail, much of which is clear. However, I get particularly confused with the Linkage Types. The linkage types apart from private, internal, external become quit...
Twentyfour asked 17/11, 2017 at 11:51

1

I created a very simple LLVM IR code piece via the API. Inside the main block, I want to insert calls to functions that are available in the C standard library such as malloc, printf or some other ...
Annamariaannamarie asked 28/10, 2018 at 1:47

1

Solved

this is my first Stackoverflow question :-) My background: 2 years Python experience 2 months crystal-lang experience ( websites running with Amber framework ) 1 month into C, C++ , assembly ...
Idden asked 18/10, 2018 at 15:10

2

Solved

If I is of type llvm::Instruction, we can print out the same in human-readable form (textual representation) by errs() << I; I want the assign the exact same representation to a std::string ...
Hautboy asked 16/5, 2017 at 9:26

1

Solved

im working on a my own programming language. Im currently generating the code in LLVM IR. I got a question on nested If statement with phi. So lets say I have this in my language : if n < 0 th...
Wideawake asked 20/8, 2018 at 0:59

3

I have three questions: 1) What are the differences between Invoke and Call operations in IR codes of LLVM? 2) Why Call instruction is not considered as Terminator operation in BasicBlocks here? ...
Geraldina asked 12/2, 2016 at 17:8

© 2022 - 2025 — McMap. All rights reserved.