Category "llvm"

How to determine if a BasicBlock is controled by a `if`

I want to use LLVM to analyze if a basic block is affected by a control flow of an if(i.e., br instruction). "A basic block BB is NOT affected by br" means that

what is the most fundamental difference between SPIR-V and LLVM-IR?

Spir-v and LLVM IR have the same granularity and can be converted to each other. May I ask why SPir-V is still so popular with LLVM IR? The fundamental differen

How to build llvm-hs from source

I'm working on parsing large llvm-ir code using haskell & llvm-hs for some research work. I used gllvm (comment on this post - Getting LLVM IR for a clang/c

How to get the information of DeclRefExpr from the basic block in Clang:CFG?

How to get the information of DeclRefExpr from the basic block in Clang:CFG? This is code i have coded class CFGPrinter : public MatchFinder::MatchCallback { pu

How to run my analysis pass on optimized ir

I write a driver to run pass in my code. void MyPassManager::addNewFuncPassByCode(string PassCode, FunctionPassManag

macOS llvm can't find stdio.h anymore

I come to you with a weird problem I've been facing. So last week, I installed llvm and libomp for a C project, and it compiled just fine with this at the start

How to build LLVM (clang,clang++) for Apple M1?

I am trying to build LLVM compilers so that I can enable OpenMP on the Apple M1. I am using the LLVM development tree, (since I saw some OpenMP runtime go into

clang DeclContext::getParent() not returning parent RecordDecl for nested structs

I'm using the following code get parent struct of a nested struct using clang libtooling. bool VisitRecordDecl(clang::RecordDecl *RD) { llvm::outs() <<

Building rust with LLVM Fork

Following the instructions here, I have tried building rust with a fork of LLVM which has a back-end for a new target. I have: Recursively cloned the Rust repos

Link nasm with ld.lld linker

I have main.s file. extern printf extern exit section .data fmt: db "hi!", 0xa section .text global _start _start: mov rax, 0 mov rdi, fmt call printf

How to use F.getValueSymbolTable()

I wanna get all the local variables in a function. void getLocalVariables(Function &F) { ValueSymbolTable *vst = F.getValueSymbolTable(); for (auto vs :

【SOLVED】LLVM DILocation: extract information from metadata

I wanna get value and 861 from a return instruction, for example ret i32 %3, !dbg !861 and it's metadata !861 = !DILocation(line: 8, column: 5, scope: !857). Bu

relocation R_X86_64_32 against symbol `G8' can not be used when making a PIE object; recompile with -fPIE

I'm trying to compile lambda-expressions from scheme to llvm-ir and am having trouble with position independet code. source: (lambda (x) (display x)) targe

ld: Invalid value (Producer: 'LLVM13.0.0-rust-1.57.0-nightly' Reader: 'LLVM APPLE_1_1300.0.29.3_0') for architecture arm64

Trying to install and work with zkgroup. Build, run for specific iOS device working fine. But generic archiving is not working. Error text: ld: Invalid value (P

How to deal with undefined symbols when loading Mono libraries in Linux

I'm porting my Windows Mono application to Linux, one step at a time, first to WSL Linux under Windows 10, then hopefully to Real Ubuntu. Everything described

Does the C++ standard allow for an uninitialized bool to crash a program?

I know that an "undefined behaviour" in C++ can pretty much allow the compiler to do anything it wants. However, I had a crash that surprised me, as I assumed t

How can I write an LLVM pass to detect redundant conditions in C / C + +

I want to write an LLVM pass to detect redundant condition pattern like this in c++. int a = ... , b = ..., c = ... //first if condition if(a == b + 1 - c){

macos llvm-symbolizer not found

I am trying to use address sanitization when calling my program with clang, however it doesn't seem to be installed. If I type which llvm-symbolizer I get llvm-

Building LLVM eats up all the RAM

I have been trying to install LLVM on my system [i7 + 16GB RAM]. I have been following this tutorial : LLVM Install. But in building, it eats up all the RAM and

How to convert a Control Flow Graph back into its source code? e.g., C/C++

I have already generated the corresponding CFG of my source code. Then, I want to modify the CFG (merge some nodes). In then end, I need to convert the modified