llvm

LLVM how to set Attributes::NoUnwind to Function?

风流意气都作罢 提交于 2020-01-15 10:14:10
问题 I think this is very simple question, but I can't resolve it. Very sad. So. When I do llc.exe -march=cpp test.bc I get interesting test.cpp with this piece of code: AttrListPtr func__Z2f1i_PAL; { SmallVector<AttributeWithIndex, 4> Attrs; AttributeWithIndex PAWI; PAWI.Index = 4294967295U; PAWI.Attrs = Attribute::None | Attribute::NoUnwind; Attrs.push_back(PAWI); func__Z2f1i_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end()); } But when I want to write string like PAWI.Attrs = Attribute::None |

Crosscompile using llvm from desktop to arm

▼魔方 西西 提交于 2020-01-15 07:54:11
问题 I am writing c code on my laptop and I would like to cross compile it to ARM v7 architecture using the llvm-clang toolchain. I am following this website http://llvm.org/docs/HowToCrossCompileLLVM.html using this command to configure cmake: I am using the following command and getting the following errors (see below). Any idea what is wrong? Thank you -------------------------------START---------------------------------------------- cmake -G Ninja /home/user/Desktop/llvm/llvm -DCMAKE

Crosscompile using llvm from desktop to arm

时光总嘲笑我的痴心妄想 提交于 2020-01-15 07:54:06
问题 I am writing c code on my laptop and I would like to cross compile it to ARM v7 architecture using the llvm-clang toolchain. I am following this website http://llvm.org/docs/HowToCrossCompileLLVM.html using this command to configure cmake: I am using the following command and getting the following errors (see below). Any idea what is wrong? Thank you -------------------------------START---------------------------------------------- cmake -G Ninja /home/user/Desktop/llvm/llvm -DCMAKE

Python numba / llvmlite on Debian 8 - i can't build llvmlite

允我心安 提交于 2020-01-14 22:48:18
问题 Im trying to install numba on a Debian 8 system as described here: http://llvmlite.pydata.org/en/latest/install/index.html (secion 2.2.3). I have installed LLVM 3.5 and it seems to find it but i keep getting errors when building llvmlite with setup.py: # python setup.py build Here is the complete output: running build got version from VCS {'version': '0.9.0.dev+7.gf5a7007.dirty', 'full': 'f5a70072ce0e7f5e432d6645056a60b00f957c66.dirty'} running build_ext /usr/bin/python ffi/build.py LLVM

how to write a clang plugin to inject some code to the original code while compiling

蹲街弑〆低调 提交于 2020-01-14 14:20:10
问题 i got a problem about how to write a clang plugin that will change the code. i want inject some code to the program,just like this:enter code here //the original code //the filename is user_code.cpp int f1(){ return 1; } int f2(){ return 2; } int f3(){ return 3; } int main(){ for(int i=0;i<1000;i++)f1(); for(int i=0;i<10000;i++)f2(); for(int i=0;i<100000;i++)f3(); return 0; } //the injected code int function_counter[3]; int f1(){ function_counter[0]++; return 1; } int f2(){ function_counter[1

how to write a clang plugin to inject some code to the original code while compiling

杀马特。学长 韩版系。学妹 提交于 2020-01-14 14:20:06
问题 i got a problem about how to write a clang plugin that will change the code. i want inject some code to the program,just like this:enter code here //the original code //the filename is user_code.cpp int f1(){ return 1; } int f2(){ return 2; } int f3(){ return 3; } int main(){ for(int i=0;i<1000;i++)f1(); for(int i=0;i<10000;i++)f2(); for(int i=0;i<100000;i++)f3(); return 0; } //the injected code int function_counter[3]; int f1(){ function_counter[0]++; return 1; } int f2(){ function_counter[1

Link C in llvmlite

喜欢而已 提交于 2020-01-14 09:53:26
问题 Im writing an compiler in Python, using llvmlite to generate intermediate LLVM IR. Lexer and parser are finished, now im doing code generation. The compiler will be dynamic and weakly typed, so i will need to do somethings at runtime, like allocation. For this, i've already implemented some functions in C, and now i want to call these functions using builder.call from llvmlite. I have not found documentation or examples of how to do this. This function its just an simple example, the real

GCC,LLVM,Clang编译器对比

被刻印的时光 ゝ 提交于 2020-01-14 08:03:09
本文转载自 https://www.cnblogs.com/qoakzmxncb/archive/2013/04/18/3029105.html 在XCode中,我们经常会看到这些编译选项(如下图),有些人可能会有些茫然,本文将对GCC4.2、LLVM GCC 4.2、LLVM compliler 2.0三个编译选项进行一个详细的介绍。 GCC GCC(GNU Compiler Collection,GNU 编译器 套装),是一套由 GNU 开发的编程语言编译器。它是一套以 GPL 及 LGPL 许可证所发行的自由软件,也是 GNU计划的关键部分,亦是自由的类Unix及苹果电脑 Mac OS X 操作系统 的标准编译器。 GCC 原名为 GNU C 语言编译器,因为它原本只能处理 C语言。GCC 很快地扩展,变得可处理 C++。之后也变得可处理 Fortran、Pascal、 Objective-C 、Java, 以及 Ada与其他语言。 LLVM LLVM 是 Low Level Virtual Machine 的简称,这个库提供了与编译器相关的支持,能够进行程序语言的编译期优化、链接优化、在线编译优化、代码生成。简而言之,可以作为多种语言编译器的后台来使用。如果这样还比较抽象的话,介绍下 Clang 就知道了:Clang 是一个 C++ 编写、基于 LLVM、发布于 LLVM

Segmentation fault while using AAResultsWrapperPass in llvm3.8.1

99封情书 提交于 2020-01-14 06:09:10
问题 I am trying to migrate my project from llvm3.6.2 to llvm3.8.1. In my code, I have used AliasAnalysis and I am changing my code as follows: #if defined(DDP_LLVM_VERSION_3_8) AU.addRequired<AAResultsWrapperPass>(); #else AU.addRequired<AliasAnalysis>(); #endif And I am passing AliasAnalysis to the function as follow: #if defined(DDP_LLVM_VERSION_3_8) foo(*F,getAnalysis<AAResultsWrapperPass>().getAAResults()); #else foo(*F,getAnalysis<AliasAnalysis>()); #endif Function declaration is as follow:

LLVM error accessing loopinfo in function pass

喜欢而已 提交于 2020-01-14 03:50:12
问题 I'm trying to get loop information from IR by writing a function pass. So I followed some examples and wrote like following. I'm not very familiar with writing passes and pass managers. #include <iostream> #include "llvm/LLVMContext.h" #include "llvm/Module.h" #include "llvm/Function.h" #include "llvm/BasicBlock.h" #include "llvm/Analysis/LoopInfo.h" #include "llvm/Support/IRReader.h" #include "llvm/Support/SourceMgr.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Analysis/LoopInfo.h"