llvm

LLVM: “Invalid bitcast” when converting a struct to identical struct

旧城冷巷雨未停 提交于 2020-01-06 05:22:10
问题 I'm working on fixing some bugs in TinyGo compiler. At the moment, I have a weird problems with bitcasting. The IR code would be as follows: %structcast.go.A = type { i32, i32, i32, i32 } %structcast.go.B = type { i32, i32, i32, i32 } ... %0 = load %structcast.go.B, %structcast.go.B* %b, !dbg !1851 %changetype = bitcast %structcast.go.B %0 to %structcast.go.A, !dbg !1852 call void @structcast.go.foo(%structcast.go.A %changetype, i8* undef, i8* undef), !dbg !1853 But during IR verification I

OCaml llvm “Unbound module ExecutionEngine”

我们两清 提交于 2020-01-06 04:00:46
问题 I made a post here (ocaml llvm kaleidoscope tutorial "Unbound module LlvmExecutionEngine") but that issue does not seem present on my mac which I have switched to. I'm trying to get this to work: https://github.com/llvm-mirror/llvm/tree/master/examples/OCaml-Kaleidoscope/Chapter7 from this tutorial http://llvm.org/docs/tutorial/OCamlLangImpl7.html (I'm 99% sure these two are by the same people) After getting around a few issues I have reached a stumbling block for the last few hours of dyn

Xcode 6: How to solve Precompile prefix Header error

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-06 02:30:44
问题 I just moved an app i've been working on from Xcode 5, onto another computer running Xcode 6, (working fine on Xcode 5) I now get the following error I assume this was an issue with a missing .pch file, when I look into this dir i found the file but its called TMU-Prefix.pch instead of TMU_4.0-Prefix.pch I figured my prefix header must be set incorrectly so I went in to build settings to change that and to my surprise my build settings is looking for the right file This file which does indeed

Filling the LLVM CloneFunction VMAP

五迷三道 提交于 2020-01-06 02:24:29
问题 I want to write some code that, given an LLVM function F, creates an exact copy in the same module (so the copy can be manipulated later while preserving the original). I want to do this with the CloneFunctionInto method. My current attempt involves trying to insert each (new arg,old arg) pair into the VMap. Previously I've tried inserting an uninitialised VMap and putting the pair the other way round. Impressively, all 3 have resulted in the exact same error message: Assertion `VMap.count(&I

LLVM IR: expose variables to GDB?

你离开我真会死。 提交于 2020-01-05 17:51:38
问题 I am writing a custom programming language. I am generating LLVM IR as an intermediate (via LLVMlite), and I want to expose variables to GDB. This is an example of the generated IR: ; ModuleID = "tests/debuginfo.xan" source_filename = "debuginfo.xan" target triple = "x86_64-unknown-linux-gnu" target datalayout = "" define void @"main"(i32 %".1", i8** %".2") !dbg !10 { entry: %"$argc" = alloca i32 store i32 %".1", i32* %"$argc" %"$argv" = alloca i8** store i8** %".2", i8*** %"$argv" %"$a" =

LLDB: Must I build it from source (XCode project) to use it from the command line?

大城市里の小女人 提交于 2020-01-05 09:52:29
问题 XCode comes with LLDB, presumably there is a way to enable it as the debugger to use when debugging XCode projects. Of course being a Linux user I have become a hardcore command-line fanatic and I have a well-established Vim and Tmux workflow. Also being a code portability freak, 100% of my scripts work on both OS X and Linux. So is there some sort of way to "Pull out" the LLDB from deep within the bowels of XCode and run it from the command line? What are the benefits of compiling it

Clang build is extremely slow and hangs up in the middle

▼魔方 西西 提交于 2020-01-05 07:13:29
问题 I am getting started with writing my own clang tools. These are the steps I have followed so far: Checked out llvm 7.0 release build Checked out clang 7.0 release build Built clang and llvm using ninja with following flags (It was hanging up on me constantly without these) -DLLVM_USE_LINKER=gold -DLLVM_PARALLEL_LINK_JOBS=1 -DLLVM_LINK_LLVM_DYLIB=true -DLLVM_USE_SPLIT_DWARF=ON -DBUILD_SHARED_LIBS=ON Installed clang Now I want to set clang as it's own compiler. So I have set these flags in

LLDB: process launch failed: Lost debug server connection

拥有回忆 提交于 2020-01-05 02:36:13
问题 I seem to have trouble getting lldb to run. I'm on a Ubuntu 14.04 system and downloaded lldb-4.0 via apt. (lldb) target create dbgme Current executable set to 'dbgme' (x86_64). (lldb) process launch error: process launch failed: Lost debug server connection I don't want to do any remote debugging. Just local debugging. Do I need to start the lldb-server either way? And if so how do I do that? 来源: https://stackoverflow.com/questions/41232160/lldb-process-launch-failed-lost-debug-server

How to call a JITed LLVM function with unknown type?

女生的网名这么多〃 提交于 2020-01-04 04:19:08
问题 I am implementing a front-end for a JIT compiler using LLVM. I started by following the Kaleidoscope example in the LLVM tutorial. I know how to generate and JIT LLVM IR using the LLVM C++ API. I also know how to call the JITed function, using the "getPointerToFunction" method of llvm::ExecutionEngine. getPointerToFunction returns a void* which I must then cast to the correct function type. For example, in my compiler I have unit test that looks like the following: void* compiled_func =

What to pass for the vmap argument of CloneFunction in llvm?

邮差的信 提交于 2020-01-03 18:53:29
问题 I am trying to clone the exact copy of another function. I have not been able to find any examples of CloneFunction usage on the internets. 回答1: It turns at the you can just create a ValueToValueMapTy variable and pass it without initialization. 回答2: The following code segment is enough for cloning the function called Func ValueToValueMapTy VMap; auto *Clone = CloneFunction(Func, VMap); rahib bob 来源: https://stackoverflow.com/questions/13104085/what-to-pass-for-the-vmap-argument-of