llvm

Meaning of the LLVM Optimization Levels

不问归期 提交于 2019-12-03 12:08:06
I recently started working with Clang/LLVM and would like to know if there is any particular documentation on what the -Ox optimization levels do? I couldn't find much on the LLVM documentation page. Can someone share a few links? Thanks. Oak Clang's command-line options documentation is indeed very poor, and in particular you are correct that there's almost no explanation of what the optimizations level do. FreeBSD, however, does add a man page with a useful summary : -O0 -O1 -O2 -Os -Oz -O3 -O4 Specify which optimization level to use. -O0 means "no optimization": this level compiles the

How is clang able to steer C/C++ code optimization?

倖福魔咒の 提交于 2019-12-03 11:50:59
问题 I was told that clang is a driver that works like gcc to do preprocessing, compilation and linkage work. During the compilation and linkage, as far as I know, it's actually llvm that does the optimization ( "-O1", "-O2", "-O3", "-Os", "-flto" ). But I just cannot understand how llvm is involved . It seems that compiling source code doesn't even need a static library such as libLLVMCore.a , instead for debian clang packages depends on another package called libllvm-3.4 (clang version is 3.4),

LLVM exception throwing

♀尐吖头ヾ 提交于 2019-12-03 11:40:23
问题 I have read this blog post, this documentation page and this example, but I still don't understand how to throw a basic exception using the LLVM's IRBuilder for a non-C++ oriented language. From my understanding, I have to : Create a llvm::Value containing the throwed value. Call "a function" , passing it the throwed value. This function will not return. The example is using a system rewinding function ( _Unwind_RaiseException ) in order to throw a C++ exception, and I don't really understand

What is an exception handling personality function?

白昼怎懂夜的黑 提交于 2019-12-03 11:37:51
I've looked at the documentation for the LLVM EH intrinsics, and also the Itanium ABI, and I'm stumped on a few things. What is an exception personality function? What jobs does it perform? How would I go about creating one? Maël Nison I had exactly the same question. I've just found these articles which thoroughly explains how it works, the full exception handling process, including the exact purpose of the personality function and a step-by-step implementation. For the sake of having an answer on SO, here is a brief summary of the personality behavior when an exception occurs (but you really

Call C/C++ functions from the ExecutionEngine

て烟熏妆下的殇ゞ 提交于 2019-12-03 11:36:38
I am learning llvm and wanted to do a proof of concept of an idea I have. Basically, I want to split my compiler and my runtime. The compiler would give a .bc and the runtime would load it via ParseBitcodeFile and use the ExecutionEngine to run it. This part is working. Now, to make system calls easily, I want to be able to implement in my runtime C/C++ functions which do all the system calls (file io, stdout printing, etc). My question is, how could I call these functions from the code from my toy compiler, which is compiled in a different step by llvm, and allow it to be used when executed.

Recompile a x86 code with LLVM to some faster one x86

六月ゝ 毕业季﹏ 提交于 2019-12-03 11:31:35
问题 Is it possible to run LLVM compiler with input of x86 32bit code? There is a huge algorithm which I have no source code and I want to make it run faster on the same hardware. Can I translate it from x86 back to x86 with optimizations. This Code runs a long time, so I want to do static recompilation of it. Also, I can do a runtime profile of it and give to LLVM hints, which branches are more probable. The original Code is written for x86 + x87, and uses no SSE/MMX/SSE2. After recompilation It

Is it possible to make Node.js use Rhino as the Javascript engine?

允我心安 提交于 2019-12-03 11:25:53
I use Node.js for several jobs on my web apps and so far everthing's ok. But the Node.js uses Google's V8 as the default Javascript engine (JSE) and V8 runs exlusively on the x86 and ARM Instruction Set Architectures (ISA). Now I have a PPC processor Mac computer on which I want to run the Node.js . To do that, I'm adviced to use the Rhino + OpenJDK Shark Virtual Machine + Low Level Virtual Machine ( LLVM ) as the JIT compiler. Currently, that looks like the most applicable way of running Node.js on the PPC ISA. Or, is there a better way to do it? Could you tell beforehand if it would be

clang的常用工具

☆樱花仙子☆ 提交于 2019-12-03 11:17:23
3. 常用工具简介 这样llvm就安装完成了。下面是llvm的常用工具简短介绍: clang: C语言编译器,类似于gcc clang++: C++编译器,类似于g++。clang++只是clang的一个别名。 clang-format:按照固定的规范格式化C/C++代码,非常智能。文档请见:http://clang.llvm.org/docs/ClangFormat.html clang-modernize:把按照C++98标准写的代码,转成C++11标准的。文档请见:http://clang.llvm.org/extra/ModernizerUsage.html llvm-as:LLVM 汇编器 llvm-dis: LLVM 反汇编器 opt:LLVM 优化器 llc:LLVM 静态编译器 lli:LLVM的字节码执行器(某些平台下支持JIT) llvm-link:LLVM的字节码链接器 llvm-ar:LLVM的静态库打包器,类似unix的ar。 llvm-nm:类似于unix的nm llvm-ranlib:为 llvm-ar 打包的文件创建索引 llvm-prof:将 ‘llvmprof.out’ raw 数据格式化成人类可读的报告 llvm-ld :带有可装载的运行时优化支持的通用目标连接器 llvm-config:打印出配置时 LLVM 编译选项、库、等等 llvmc

Sample CMakeLists.txt file for LLVM project

烂漫一生 提交于 2019-12-03 11:06:35
问题 I am having a hard time to get LLVM to work on a new project. I've tried multiple CMakeLists.txt examples from http://old.nabble.com/CMake-sample-project--td28871124.html and used a lot of time on it. I can build LLVM and the examples perfectly but I want a project which is not inside the LLVM folder. I use Visual Studio 2010 on Windows 7. Right now my setup is this: root - CMakeLists.txt (1) main - CMakeLists.txt (2) - main.cpp (an exact copy of the Fibonacci example) (1) cmake_minimum

LLVM and compiler nomenclature

断了今生、忘了曾经 提交于 2019-12-03 10:42:57
I am looking into the LLVM system and I have read through the Getting Started documentation . However, some of the nomenclature (and the wording in the clang example) is still a little confusing. The following terms and commands are all part of the compilation process, and I was wondering if someone might be able to explain them a little better for me: clang -S vs. clang -c (I know what -c does, but how do the results differ?) * (Edit) LLVM Bitcode vs. LLVM IR (what is the difference?) .ll files vs. .bc files (what are they, how do they differ?) LLVM assembly code vs. native assembly code (is