llvm-ir

llvm exceptions - RaiseException “?:Unknown signal”

独自空忆成欢 提交于 2020-01-03 12:32:34
问题 I'm trying to get exceptions working with llvm for a very simple example, that I can later build on but i'm running into some real difficulties and i'm not sure why. I got clang to give me the following llir code, that I am passing into the MCJIT ; llvm-as c++exn.ll && llvm-ld -native c++exn.bc -lstdc++.6 && ./a.out %"class.std::ios_base::Init" = type { i8 } %"class.std::basic_ostream" = type { i32 (...)**, %"class.std::basic_ios" } %"class.std::basic_ios" = type { %"class.std::ios_base", %

llvm exceptions - RaiseException “?:Unknown signal”

假装没事ソ 提交于 2020-01-03 12:32:07
问题 I'm trying to get exceptions working with llvm for a very simple example, that I can later build on but i'm running into some real difficulties and i'm not sure why. I got clang to give me the following llir code, that I am passing into the MCJIT ; llvm-as c++exn.ll && llvm-ld -native c++exn.bc -lstdc++.6 && ./a.out %"class.std::ios_base::Init" = type { i8 } %"class.std::basic_ostream" = type { i32 (...)**, %"class.std::basic_ios" } %"class.std::basic_ios" = type { %"class.std::ios_base", %

Compiler output language - LLVM IR vs C

牧云@^-^@ 提交于 2019-12-30 03:09:08
问题 For writing a compiler, what are the advantages and disadvantages of using LLVM IR vs C for a target language? I know both are used, and I imagine that the final machine code would be similar if I were to use clang to compile the C. So what are other things to consider? 回答1: I've used LLVM IR for a few compiler back ends and have worked with compilers that use C as a back end. One thing that I found that gave the LLVM IR an advantage is that it is typed. It is hard to make completely ill

Why does this LLVM IR code produce unexpected results?

半城伤御伤魂 提交于 2019-12-25 18:33:47
问题 I'm getting really frustrated, since this problem has been bugging me for days, so I'd appreciate every help possible. I'm currently making my own programming language and am currently trying to implement enums and match statements that match a value to an enum case and runs the corresponding statement but I'm getting unexpected results and segfaults here and there. Here's one piece of code of my language that runs (lli) but produces unexpected results sometimes (prints 1, not 3 for some

Generate LLVM IR for httpd

六月ゝ 毕业季﹏ 提交于 2019-12-24 12:21:42
问题 I am trying to compile apache2 with LLVM, to generate final binaries in LLVM IR. I used flto option in compiling and linking and passed "also-emit-llvm" to the linker through clang. It seems to work for most steps, however I had two concerns 1) Earlier I used LLVM 3.6, whose gold plugin doesn't accept also-emit-llvm, but has emit-llvm only, basically it will emit only elf or llvm. Which the Autotools build system doesn't like. The configure and make script want binaries, while I want llvm.

LLVM Interoperability (Like JVM or .Net) - Is it possible to do?

六眼飞鱼酱① 提交于 2019-12-24 05:26:09
问题 I recently played around a bit with different LLVM Frontends like Clang (C Familiy ), LDC2 (D), Terra, ... All these languages can be compiled into the LLVM IR (somewhat readable) and LLVM IR Bitcode . So at this stage they are all on the same "level" right? My Question is : Is there some way of language interoperability like the .NET Languages or JVM Languages on "language level" or is it only possible to do it by editing in the IR? I already looked this question up in Google but didn't find

Is it possible to specify a hexadecimal number in LLVM IR code?

爷,独闯天下 提交于 2019-12-24 03:48:19
问题 For example: error: floating point constant invalid for type %3 = and i8 0x80, %2 ^ 回答1: From a scan of the IR reference manual, it looks like hexadecimal literals are reserved for the representation of floating point numbers that cannot be exactly represented in a reasonable number of digits. Which explains why your error message says that the floating point constant is invalid. 来源: https://stackoverflow.com/questions/16310509/is-it-possible-to-specify-a-hexadecimal-number-in-llvm-ir-code

How to get all the line number of a variable from source code given LLVM IR?

喜你入骨 提交于 2019-12-24 02:44:07
问题 I am totally a newbie in LLVM. I wanted to know how we can get all the line numbers for a particular variable from source code given LLVM IR? For example (showing snippet of LLVM IR) store i32 0, i32* %i, align 4, !dbg !12 !12 = !DILocation(line: 2, column: 6, scope: !7) %4 = load i32*, i32** %ip, align 8, !dbg !30 !30 = !DILocation(line: 7, column: 4, scope: !25) I believe, from inspecting LLVM IR, getting the line number details for any variable has something to do with accessing !dbg at

LLVM Error : External function could not be resolved

混江龙づ霸主 提交于 2019-12-22 11:20:44
问题 I am reading the LLVM's Kaleidoscope tutorial (http://llvm.org/docs/tutorial/index.html). I wanted to compile and test the language. After some compiler's errors (EngineBuilder and Module's constructor, linking libs...), the example program was built. Then, I tried the language. I got a few problems with InitializeNativeTargets, DataLayoutPass... But I managed to correct them. Howewer, I don't manage to resolve one error. When I write extern printd(x); printd(5); , the program doesn't work :

OpenCL LLVM IR generation from Clang

佐手、 提交于 2019-12-22 00:06:20
问题 I am using the following command line for clang: clang -Dcl_clang_storage_class_specifiers -isystem $LIBCLC/generic/include -include clc/clc.h -target nvptx--nvidiacl -x cl some_kernel.cl -emit-llvm -S -o some_kernel.ll the result is: ; ModuleID = 'kernel.cl' target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v16:16:16-v32:32:32-v64:64:64-v128:128:128-n16:32:64" target triple = "nvptx--nvidiacl" ; Function Attrs: noinline nounwind define void