llvm

LLVM. How to access to struct fields based on their names?

时间秒杀一切 提交于 2019-11-30 10:00:53
I have little example code in C++: struct RecordTest { int value1; int value2; }; void test() { RecordTest rt; rt.value1 = 15; rt.value2 = 75; } and LLVM 3.4 IR for it: %struct.RecordTest = type { i32, i32 } ; Function Attrs: nounwind define void @_Z4testv() #0 { entry: %rt = alloca %struct.RecordTest, align 4 %value1 = getelementptr inbounds %struct.RecordTest* %rt, i32 0, i32 0 store i32 15, i32* %value1, align 4 %value2 = getelementptr inbounds %struct.RecordTest* %rt, i32 0, i32 1 store i32 75, i32* %value2, align 4 ret void } and a pretty easy question: How can I access to RecordTest

Why is the -ObjC linker flag needed to link categories in static libraries? (LLVM)

隐身守侯 提交于 2019-11-30 08:57:47
Regarding this technical Q&A from Apple: http://developer.apple.com/library/mac/#qa/qa1490/_index.html I think the compiler could mark calls to methods defined in categories at compile-time (it knows that they were defined in a category and not the main class because the prototype was in an @interface Class (Category) section) - so it could build a table in the object files of "external category methods". Then the linker, after doing its normal linking, should be able to concatenate/merge and process the "external category methods" tables from all objects and look for matching symbols in

Is there a Clang mingw cross compiler for Linux

女生的网名这么多〃 提交于 2019-11-30 08:54:19
In Linux, and specifically on Debian or Ubuntu, there are pre-packaged Mingw cross compilers which can generate Windows EXEs. But is there a similar cross compiler using Clang instead of GCC? (Or instructions on how to build such a beast.) I've written a tool with which you can compile easily with clang for windows on linux. Check out: https://github.com/tpoechtrager/wclang . 来源: https://stackoverflow.com/questions/12704537/is-there-a-clang-mingw-cross-compiler-for-linux

How to write a custom intermodular pass in LLVM?

左心房为你撑大大i 提交于 2019-11-30 08:50:15
I've written a standard Analysis pass in LLVM, by extending the FunctionPass class. Everything seems to make sense. Now what I'd like to do is write a couple of intermodular passes, that is, passes that allows me to analyze more than one module at a time. The purpose of one such pass is to construct a call graph of the entire application. The purpose of the other such pass is that I have an idea for an optimization involving function calls and their parameters. I know about interprocedural passes in LLVM, via extending the ModulePass class, but that only allows analysis within a single module.

Why don't iOS framework dependencies need to be explicitly linked to a static library project or framework project when they do for an app project?

一个人想着一个人 提交于 2019-11-30 07:27:26
Why exactly is it that when I create an iOS static library project or framework project in Xcode, I don't need to link any iOS SDK frameworks to the project in order to make use of their headers and objects -- for example, I can #import <AudioToolbox/AudioToolbox.h> and put AudioToolbox code in the static library or framework without actually having AudioToolbox added under "Link Binary with Libraries" in build settings or having it present in the file navigator, and the project will build without issue, something that wouldn't work in an app project -- but when a developer then uses the

How to cross-compile clang/llvm for iOS?

我怕爱的太早我们不能终老 提交于 2019-11-30 07:26:55
How to cross-compile clang/llvm for iOS? I need to get libclang (.a or .dylib i believe) to use it via C API in my iOS app. # Get LLVM/Clang mkdir llvm curl -O http://llvm.org/releases/3.4/llvm-3.4.src.tar.gz tar xzfv llvm-3.4.src.tar.gz cd llvm-3.4/tools/ curl -O http://llvm.org/releases/3.4/clang-3.4.src.tar.gz tar xzfv clang-3.4.src.tar.gz mv clang-3.4 clang cd .. # Assuming Xcode 5.1 (LLVM 3.5+ requires -stdlib=libc++ as well) export CC="clang -arch armv7 -mios-version-min=5.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk"

What are the differences between LLVM and java bytecode?

两盒软妹~` 提交于 2019-11-30 06:18:52
问题 I dont understand the difference between LLVM and the java (bytecode), what are they? -edit- by 'what are they' i mean the differences between LLVM and java (bytecode) not what are LLVM and java. 回答1: Assuming you mean JVM rather than Java: The LLVM is a low level register-based virtual machine. It is designed to abstract the underlying hardware and draw a clean line between a compiler back-end (machine code generation) and front-end (parsing, etc.). The JVM is a much higher level stack-based

Source-to-source compilation with LLVM [closed]

坚强是说给别人听的谎言 提交于 2019-11-30 05:33:31
I need to convert x86 assembly source code to LLVM human-readable .ll file (aka LLVM assembly language). How can I do this? If there is no direct solution would it be possible to implement one within the LLVM infrastructure with as less efforts as possible? I guess, the solution I'm looking for should be some kind of llc 's counterpart that converts .s file back to .ll representation. bsa2000 Just for those who are still seeking for more information on this topic, I want to share the information about one ongoing project ( http://dslab.epfl.ch/proj/s2e ) that I've found on the web. The project

LLVM build options for ARM / RaspberryPi

佐手、 提交于 2019-11-30 05:26:28
I'm seeking clarification of what the best build options are for LLVM 3.2 on Raspbian I've fetched the LLVM source of 3.2, and my config is: cd llvm-3.2.src ./configure --build=armv6-unknown-linux-gnueabi \ --host=armv6-unknown-linux-gnueabi \ --target=armv6-unknown-linux-gnueabi --with-cpu=arm1176jzf-s \ --with-float=hard --with-abi=aapcs-vfp --with-fpu=neon \ --enable-targets=arm --enable-optimized --enable-assertions make REQUIRES_RTTI=1 sudo make install I've heard it takes quite a number of hours to build. It's been running a few hours now, happy to just let it run though. It's a long

Compile, Assemble and Disassemble Using the LLVM Tool Chain

蓝咒 提交于 2019-11-30 05:16:20
问题 I'm trying to run the following example to Compile, Assemble and Disassemble an small program using the LLVM tool chain. My intention is to learn how it works so in further tries I could do some performance test by changing and/or reordering the assmbly's instructions. To start with, I first get the bite code of a dummy program: % llvm-gcc -O3 -emit-llvm hello.c -c -o hello.bc Once I have the bite code, i try to use the llvm-dis utility to take a look at the LLVM assembly code and llc to