llvm

LLVM how to get callsite file name and line number

淺唱寂寞╮ 提交于 2019-12-06 07:10:49
I am very very new to LLVM, and it's my first time to write C++ I need to find several function info related to LLVM CallSite, however, I have checked the source code here: LLVM CallSite Source Code Still don't know where to get call site file name (eg. CallSite is in example.c file), call site line number (eg. at line 18 in the whole program) Do you know how can I get call site file name and line number? You can get this information by retrieving debug information from the called function. The algorithm is the following: You need to get underlying called value, which is a function. Then you

LLVM translation unit

会有一股神秘感。 提交于 2019-12-06 07:03:20
问题 I try to understand LLVM program high level structure. I read in the book that " programs are composed of modules ,each of which correspons to tranlation unit ".Can someone explain me in more details the above and what is the diffrenece between modules and translation units(if any). I am also interested to know which part of the code is called when translation unit starts and completes debugging information encoding? 回答1: Translation unit is term from language standard. For example, this is

How to get the filename and directory from a LLVM Instruction?

六眼飞鱼酱① 提交于 2019-12-06 06:50:18
问题 I need to extract the directory and filename during a llvm pass. The current version of llvm moved getFilename and getDirectory from DebugLoc to DebugInfoMetadata . I can't find a class member getFilename directly in the DebugLoc header. Thus, how to do I go from an instruction to source code filename and directory? http://llvm.org/docs/doxygen/html/classllvm_1_1DebugLoc.html Additionally, there is a print function that might help but it only takes a llvm::raw_ostream and can't be redirected

Compilation failing on EnableABIBreakingChecks

送分小仙女□ 提交于 2019-12-06 06:42:18
问题 I recently installed LLVM v8.0.0 (on RHEL 7.4). I am going through the LLVM Kaleidoscope tutorial to learn how to use the system, but am running into an issue linking. Per the tutorial (end of chapter 2), I run: clang++ -g -O3 kld.cpp `llvm-config --cxxflags` -o kld It compiles, but the linker fails on: /tmp/kld-f7264f.o:(.data+0x0): undefined reference to `llvm::EnableABIBreakingChecks' clang-8: error: linker command failed with exit code 1 (use -v to see invocation) I suspected this may

At which level does one unit test lock-free code?

大城市里の小女人 提交于 2019-12-06 06:20:02
问题 Can LLVM, QEMU, GDB, Bochs, OpenStack or the like be used to unit test lock-free concurrent code on an open-source platform? Has anyone achieved this? If you answer by recommending software, I don't mind, but I mention LLVM, QEMU and the others because these function at various different levels. I should like to learn at which level practical success has been found at interleaving threads under unit-test control. I am aware of SPIN/Promela, incidentally. That is fine software but one cannot

move function body, avoiding full cloning

倾然丶 夕夏残阳落幕 提交于 2019-12-06 05:59:07
This is a follow up question from this one . I am using llvm::CloneFunctionInto defined in llvm/Transforms/Utils/Cloning.h in order to create a new function after code generation with the right signature inferred from the type of the return values. This works nicely but it is slow I am trying to optimize this a little bit by some way to move or transfer the function body from the old function to the new one, is there a utility for that? I am trying to hack a way to do the transfer by looking at the code in CloneFunctionInto , but wanted to see if an existing function exists Shamelessly stolen

Alias Analysis in LLVM

耗尽温柔 提交于 2019-12-06 05:56:13
问题 I am trying to find the alias between a store instruction's pointer operand and function arguments. This is the code, virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequiredTransitive<AliasAnalysis>(); AU.addPreserved<AliasAnalysis>(); } virtual bool runOnFunction(Function &F) { AliasAnalysis &AA = getAnalysis<AliasAnalysis>(); for(Function::iterator i=F.begin();i!=F.end();++i){ for(BasicBlock::iterator j=i->begin();j!=i->end();++j) { if(dyn_cast<StoreInst>(j)){ const

program loading/execution

孤者浪人 提交于 2019-12-06 05:54:32
问题 I'm a beginner in compilers but I'm very interested in learning about how a program is structured (the binary) and how it is read and loaded in memory for execution. What ebooks/books/tutorials do you guys suggest me reading for a quick start? 回答1: Compilers and executable binaries are remotely related. (the actual executable is built by the linker ld , not the compiler). On Linux systems, the linux kernel use copy-on-write and demand-paging techniques to lazily load the program pages, for

Install numba 0.30.1 on ubuntu 16.04 lts

我们两清 提交于 2019-12-06 04:33:48
How do I install the current version (0.30.1) of numba for Python 3 on Ubuntu 16.04 LTS? My version of Python is 3.5.2, and I have a barebones install of Ubuntu (server edition I think) Okay so after a couple of hours of figuring things out, I've decided that this is painful enough to share and not let others figure out. First, set up the basics: install Python 3, Git and g++ sudo apt install python3 git g++ Then get python3 packages PyPI (aka pip) and NumPy sudo apt python3-pip pip3 install numpy Before we start, decide now if you want Anaconda now: it makes it a LOT easier, and you DO get

Debugging with Clang

痞子三分冷 提交于 2019-12-06 04:21:53
问题 I'd like to use clang on my Xcode iPhone project. However this is the getting started guide: http://clang.llvm.org/get_started.html I've been working with Xcode for a year but this is far far far from being understandable to me! Can anyone explain in plain english how to install and use Clang with my existing iPhone project? I am not familiar with loading things from the console. Thanks! Dan 回答1: Nikita Zhuk has wrapped Clang in a GUI and made it available at http://www.karppinen.fi