llvm

get Tiramisu submodules llvm for Halide failed with .//3rdParty/llvm: No such file or directory error

与世无争的帅哥 提交于 2019-12-13 02:49:24
问题 Hi i'm trying to install tiramisu compiler. and once trying install it's sub-modules ( (ISL, LLVM and Halide) by using this command dina@dina-VBox:~/tiramisu$ ./utils/scripts/install_submodules.sh ./ and i get in the end this error Done installing isl #### Installing LLVM #### cd .//3rdParty/llvm .//utils/scripts/functions.sh: line 6: cd: .//3rdParty/llvm: No such file or directory even one i do ls i find it dina@dina-VBox:~/tiramisu/3rdParty$ ls clang Halide isl llvm and this is llvm content

llvm's cmake integration

戏子无情 提交于 2019-12-13 02:28:54
问题 I'm currently building a compiler/interpreter in C/C++. When I noticed LLVM I thought it would fit greatly to what I needed and so I'm trying to integrate LLVM in my existing build system (I use CMake). I read this bout integration of LLVM in CMake. I copy and pasted the example CMakeLists.txt, changed the LLVM_ROOT to ~/.llvm/ (that's where I downloaded and build LLVM and clang) and it says it isn't a valid LLVM-install. Best result I could achieve was the error message "Can't find

How do I correclty implement an LLVM InstVisitor?

戏子无情 提交于 2019-12-13 01:54:07
问题 To learn LLVM I made a ModulePass that runs through the functions, basic blocks, and finally instructions. At some point I want to dig into the instructions and perform analysis. While reading the documentation I came across http://llvm.org/docs/doxygen/html/classllvm_1_1InstVisitor.html and the documentation recommends using these structures to efficiently traverse IR rather than do a lot of if(auto* I = dyn_cast<>()) lines. I tried making a variation of the documentation example, but for

How to save the variable name when use clang to generate llvm ir?

橙三吉。 提交于 2019-12-13 00:07:29
问题 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 i32 @main(i32, i8**) #0 { %3 = alloca i32, align 4 %4 = alloca i32, align 4 %5 = alloca i8**, align 8 %6 = alloca i32*, align 8 store i32 0, i32* %3, align 4 store i32 %0, i32* %4, align 4 store i8** %1, i8*** %5, align 8 store i32* null, i32** %6, align 8 %7 = call noalias i8* @malloc(i64 4) #3 %8 =

Emscripten can't find path to cmake

点点圈 提交于 2019-12-12 20:32:25
问题 I've gone over the instructions several times, looked in countless forums, and still can't resolve this issue. I'm running Windows 10, and simply trying to install Emscripten. I've got Emscripten installed: I run # Fetch the latest registry of available tools. emsdk update followed by # Download and install the latest SDK tools. emsdk install latest But it continues to throw the same warning about being unable to find the path to cmake. I've downloaded and installed cmake-3.3.2-win32-x86 . I

LLVM “Instruction does not dominate all uses” - Inserting new Instruction

元气小坏坏 提交于 2019-12-12 20:09:31
问题 I am getting the following error while inserting an instruction using an llvm pass: Instruction does not dominate all uses! %add = add nsw i32 10, 2 %cmp3 = icmp ne i32 %a.01, %add Broken module found, compilation aborted! I have the source code in a bitcode file whose snippet is: if.then: ; preds = %entry %add = add nsw i32 10, 2 br label %if.end if.else: ; preds = %entry %sub = sub nsw i32 10, 2 br label %if.end if.end: ; preds = %if.else, %if.then %a.0 = phi i32 [ %add, %if.then ], [ %sub,

Adding a new attribute on source code that propagates until MC level in LLVM?

放肆的年华 提交于 2019-12-12 16:28:10
问题 I am interested in how the following is propagated: void foo(int __attribute__((aligned(16)))* p) { ... } In this case the “alignedness” of the pointer is available at the MC level, but it is evidently not using the LLVM-IR metadata approach to achieve this. The alignment information is very important to some targets which will change code-generation dependent on this value, and I think that what I need is more like this attribute. How difficult would it be to add a new attribute such that it

未来Linux Kernel 将不支持可变长数组VLA

此生再无相见时 提交于 2019-12-12 12:53:56
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 但使用 VLA 会存在问题,包括增加运行时开销——因为数组长度需要在运行时确定; LLVM Clang 编译器不支持结构内 VLA,它只支持 C99 风格的 VLA;存在安全隐患。Linus Torvalds 对 VLA 的使用公开表达过不赞成,认为相比固定长度,VLA 产生了更多的代码和更慢的代码。 通过开发中的Linux 4.20内核,它现在可以实现无VLA ...可变长度数组(VLA)可以方便并且是C99标准的一部分,但可能会产生意想不到的后果。 VLA允许在运行时而不是编译时确定数组长度。 Linux内核长期以来一直依赖于内核不同部分的VLA(包括结构内部),但现在持续数月(如果计算内核Clang的工作数年,则已经过去几年)已经删除了可变长度数组的使用在内核中。它们的问题是: - 由于需要在运行时确定数组的大小,因此使用可变长度数组会给代码添加一些较小的运行时开销。 - LLVM Clang编译器不支持结构中的VLA,因此对于那些想要在GCC之外构建内核的人来说,Clang只支持C99风格的VLA。 - 可以说最重要的是,VDA可能会对内核的堆栈使用产生安全隐患。 Linus Torvalds在过去对VLA的使用表达了他的不满,例如“使用VLA是积极的愚蠢!它产生了更多代码,更多_slower_代码

Pass structure by parameter with LLVM

大兔子大兔子 提交于 2019-12-12 12:30:34
问题 Is it possible to pass structure by parameter ? Is it compatible with the C abi ? [edit] Basically, I would like to have a C++ POD which would contain two members (the structure would be a fat pointer, with a pointer and an integer), and be able to pass this structure as function parameter in call instructions (even when calling C code). I'm not using fat pointer now (the pointer and the integer are each in a different function parameter), and I would like to know if it's possible before

Compiling C++ on the fly: clang/libtooling fails to set Triple for LLVM IR

跟風遠走 提交于 2019-12-12 12:16:48
问题 Let's say I want to compile a C++ string on the fly: llvm::LLVMContext context; std::unique_ptr<clang::CodeGenAction> action = std::make_unique<clang::EmitLLVMOnlyAction>(&context); clang::tooling::runToolOnCode/*WithArgs*/(action.get(), "int foo(int x){ return ++x;}"); std::unique_ptr<llvm::Module> module = action->takeModule(); Unfortunately, it seems that when LLVM tries to transform the IR, there is an exception saying that the Triple is not set (https://clang.llvm.org/docs