llvm

Using CMake's include_directories command with white spaces

血红的双手。 提交于 2019-12-23 16:30:11
问题 I am using CMake to build my project and I have the following line: include_directories(${LLVM_INCLUDE_DIRS}) which, after evaluating LLVM_INCLUDE_DIRS , evaluates to: include_directories(C:\Program Files\LLVM\include) The problem is that this is being considered two include directories, "C:\Program" and "Files\LLVM\include". Any idea how can I solve this problem? I tried using quotation marks, but it didn't work. EDIT: It turned out that the problem is in the file llvm-3.0\share\llvm\cmake

LLVM produced by rustc gives error about argument type of main when run with lli

二次信任 提交于 2019-12-23 10:19:57
问题 I'm trying to learn a little about the LLVM IR, particularly what exactly rustc outputs. I'm having a little bit of trouble running even a very simple case. I put the following in a source file simple.rs : fn main() { let x = 7u32; let y = x + 2; } and run rustc --emit llvm-ir simple.rs to get the file simple.ll , containing ; ModuleID = 'simple.cgu-0.rs' source_filename = "simple.cgu-0.rs" target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu"

Linking with code that does not support exception handling (C++/LLVM)

淺唱寂寞╮ 提交于 2019-12-23 09:11:48
问题 I am trying to use llvm as a code-generation back-end to my software and just realized that llvm was compiled without support for C++ exception handling (for efficiency). In my software, however, I use exception handling extensively. If I wrap all my callback functions in try-catch-blocks (so that no exceptions need to be propagated "through" the llvm code), can I then safely remove the "-fno-exceptions" (for GCC) from my linker flags? (this flag is normally required when linking with llvm,

LLVM学习笔记(51)

烂漫一生 提交于 2019-12-23 08:53:23
3.10. X86折叠表的生成( v7.0) 指令折叠是在寄存器分配过程中执行的优化,目的是删除不必要的拷贝指令。例如,这样的一组指令: %EBX = LOAD %mem_address %EAX = COPY %EBX 可以被安全地替换为单条指令: %EAX = LOAD %mem_address 通常,后者较前者更小,更快。 在 X86 中,许多指令有内存形式与寄存器形式,即通过内存或寄存器传递操作数。为了执行指令折叠优化,需要某种方式将这两种形式的同一条指令关联起来。目前 LLVM 维护了几张体量庞大的表用于关联这些指令。 Intel 以色列的雇员 Ayman Musa 开发了这部分的 codegen ,希望能通过 TableGen 自动生成这些表。不过这部分代码目前因为尚有 bug ,没有默认生成。 这里 有关于这个 bug 的描述。 总的来说,这是因为 Musa 的主要假设是同一条指令的这两个形式共享相同的编码信息,除了负责“如何向指令传递参数”的部分,其中一个版本定义其中一个参数是寄存器,另一个版本定义它为内存操作数,而其他参数以相同方式传递。 但实际上,某些指令在寄存器与内存形式间有不同与上面假设的情形,例如 bt (比特测试)指令,其寄存器形式寄存器参数相关比特是第 4 、 5 、 6 比特(依赖于模式与寄存器大小),而内存形式相关比特是第 16 、 32 或 64

Is there any Javascript engine that emits LLVM bytecode?

 ̄綄美尐妖づ 提交于 2019-12-23 07:25:08
问题 I've been searching for a while now, but I could not find any engine that emits LLVM bytecode. But somehow I cannot belief there is no such engine :) 回答1: JXcore will be your best bet going forward IMHO - when they convert from V8 to LLVM, which is an objective of theirs when they reach version 2 (according to their roadmap), it will then compile your javascript sources into native code. You can get more info on JXcore here. This part of the answer is in a response to Albert's answer:

Is there any Javascript engine that emits LLVM bytecode?

烈酒焚心 提交于 2019-12-23 07:21:53
问题 I've been searching for a while now, but I could not find any engine that emits LLVM bytecode. But somehow I cannot belief there is no such engine :) 回答1: JXcore will be your best bet going forward IMHO - when they convert from V8 to LLVM, which is an objective of theirs when they reach version 2 (according to their roadmap), it will then compile your javascript sources into native code. You can get more info on JXcore here. This part of the answer is in a response to Albert's answer:

How to link a library with clang and llvm-link

心已入冬 提交于 2019-12-23 06:21:04
问题 I am compiling my program like this, clang++ -O4 -emit-llvm file1.cpp -c -o file1.bc -pthread clang++ -O4 -emit-llvm file2.cpp -c -o file2.bc -pthread llvm-link file1.bc file2.bc -o main.ll -S How do I specify linking with -ldl 回答1: llvm-link is a program which "links" together LLVM IR files into a single IR file; you can read more about it here. It does not have any relation to ld or to linking object files together. If you do want to generate object code and/or executables, see these

Value* to Instruction*/LoadInst* casting [closed]

柔情痞子 提交于 2019-12-23 04:37:14
问题 This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 6 years ago . Can you please tell me if it is possible in LLVM to cast a Value* to an Instruction*/LoadInst* if for example isa<LoadInst>(MyValue) is true? In my

How do I print out an Instruction in LLVM?

↘锁芯ラ 提交于 2019-12-23 04:02:10
问题 for (BasicBlock::iterator i = bb->begin(), e = bb->end(); i != e; ++i) { i.print(errs()); ??? I am writing an LLVM PASS and I want to get the list of instructions inside the basic block, but how do print them out on the console so I can see them? The code above shows the code i have tried, it iterates through every instruction in the basic block but I get the error below for the print function. error: ‘llvm::BasicBlock::iterator’ has no member named ‘print’ i.print(errs()); Is there a better

How to define string type in getOrInsertFunction() llvm?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-23 02:36:23
问题 I'm new to llvm and was trying to do instrument. But I found LLVM API only has primitive types, like: getInt32Ty(Ctx).. What i want to do use getOrInsertFunction(),the function argument type is string type.As is known, when argument type is int, we can do it like is : LLVMContext &Ctx = F.getContext(); Constant *logFunc = F.getParent()->getOrInsertFunction( "logop", Type::getVoidTy(Ctx), Type::getInt32Ty(Ctx), NULL ); Type::getInt32Ty(Ctx) is the function argument type (int), what i want to