llvm

How do I get debug information from a function?

安稳与你 提交于 2019-12-21 16:59:47
问题 I've used Clang to compile a function with debug information enabled. For Instruction s there's the handy getDebugLoc() , but there's no such thing for Function s. Given a Function instance, how can I get the debug information (I'm guessing in DISubProgram form) for it? I've seen the guide entry explaining how that debug information is represented, and the metadata does contain a link back to the function, but there's apparently no link back. Am I supposed to iterate over all the metadata in

what optimization passes are done for -O4 in clang?

老子叫甜甜 提交于 2019-12-21 16:58:44
问题 We are trying to implement a jit compiler whose performance is supposed to be same as doing it with clang -o4. Is there a place where I could easily get the list of optimization passes invoked by clang with -o4 is specified? 回答1: As far as I know -O4 means same thing as -O3 + enabled LTO (Link Time Optimization). See the folloing code fragments: Tools.cpp // Manually translate -O to -O2 and -O4 to -O3; Driver.cpp // Check for -O4. Also see here: You can produce bitcode files from clang using

Linking against clang-llvm

强颜欢笑 提交于 2019-12-21 16:56:12
问题 I've been working on a small tool with clang/llvm but I haven't been able to successfully get g++ and gnu's linker to properly link my code against clang. my linker is generating the following errors: undefined reference to `clang::FileManager::~FileManager()' undefined reference to `clang::FileManager::FileManager()' undefined reference to `llvm::sys::getHostTriple()' undefined reference to `clang::Diagnostic::Diagnostic(clang::DiagnosticClient*)' undefined reference to `llvm::outs()'

generating CFG for whole source code with LLVM

笑着哭i 提交于 2019-12-21 15:47:38
问题 Does anyone from LLVM community know if there is a way to generate CFG for the whole input source code using opt -dot-cfg foo.ll(.bc) ? as this one generates the CFG per function thus the connections between functions will be ignored. It seems that the older analyze tool has depreciated. 回答1: I wonder if you found any way to get interprocedural CFG. I found that inlining call functions by other inliner passes might be helpful but I couldn't be able to get it to work yet. I've posted this

generating CFG for whole source code with LLVM

隐身守侯 提交于 2019-12-21 15:46:12
问题 Does anyone from LLVM community know if there is a way to generate CFG for the whole input source code using opt -dot-cfg foo.ll(.bc) ? as this one generates the CFG per function thus the connections between functions will be ignored. It seems that the older analyze tool has depreciated. 回答1: I wonder if you found any way to get interprocedural CFG. I found that inlining call functions by other inliner passes might be helpful but I couldn't be able to get it to work yet. I've posted this

Collecting LLVM Edge Profiling with llvm-prof

老子叫甜甜 提交于 2019-12-21 12:36:52
问题 I'm using these commands to compile the code below in order to collect edge/blocks profiling in trunk-llvm: clang -emit-llvm -c sort.c -o sort.bc opt -insert-edge-profiling sort.bc -o sort_prof.bc clang sort_prof.bc -lprofile_rt -L/llvms/lib -o sort_prof then I run the program and display the profiling information using llvm-prof sort_prof.bc, and the result is: ===-------------------------------------------------------------------------=== Function execution frequencies: ## Frequency 1. 4.3e

Accessing elements in LLVM arrays

被刻印的时光 ゝ 提交于 2019-12-21 09:00:12
问题 I am trying to get started with LLVM in order to add just-in-time compilation for my code, but finding it very difficult find references on how to do the things I want in LLVM, despite having checked through the Kaleidoscope tutorial, the language reference manual, the programmer's manual and the doxygen documentation. Are there more references to LLVM's C++ API than these? Now for the concrete question. I have allocated an array object with two elements (which I assume corresponds to double

Which optimization does LLVM perform?

我的梦境 提交于 2019-12-21 08:48:50
问题 I would like concretely to know what does the various optimizations levels of LLVM correspond to. That is to say, I would like to know which optimization passes are EXACTLY executed (outside the frontend) and in which order when I use the "-0x" options of llvm (or clang or opt). The "man" of the corresponding tools do not provide much information on this matter (to the oposite of gcc's one). I am aware of this useful page: http://llvm.org/docs/Passes.html, but it does not provide any

Which optimization does LLVM perform?

落花浮王杯 提交于 2019-12-21 08:48:44
问题 I would like concretely to know what does the various optimizations levels of LLVM correspond to. That is to say, I would like to know which optimization passes are EXACTLY executed (outside the frontend) and in which order when I use the "-0x" options of llvm (or clang or opt). The "man" of the corresponding tools do not provide much information on this matter (to the oposite of gcc's one). I am aware of this useful page: http://llvm.org/docs/Passes.html, but it does not provide any

Which optimization does LLVM perform?

北城以北 提交于 2019-12-21 08:48:07
问题 I would like concretely to know what does the various optimizations levels of LLVM correspond to. That is to say, I would like to know which optimization passes are EXACTLY executed (outside the frontend) and in which order when I use the "-0x" options of llvm (or clang or opt). The "man" of the corresponding tools do not provide much information on this matter (to the oposite of gcc's one). I am aware of this useful page: http://llvm.org/docs/Passes.html, but it does not provide any