llvm

Xcode 3.2.1 GCC CLANG and LLVM demystification

十年热恋 提交于 2019-11-28 17:12:15
The readme included with the new Xcode 3.2.1 this week says the following: Static code analysis is fully integrated within the Xcode IDE via the Build and Analyze option under the Build menu or via custom build settings GCC 4.2 is the default system compiler for the 10.6 SDK The optional LLVM compiler is included using two different front ends - the Clang compiler is a leading-edge parser that offers dramatically improved compile times. For maximum compatibility, the GCC LLVM compiler utilizes the LLVM back-end with the GCC 4.2 parser. New optional Clang-LLVM 1.0 compiler uses the much faster

Call LLVM Jit from c program

偶尔善良 提交于 2019-11-28 16:53:29
I have generated a bc file with the online compiler on llvm.org, and I would like to know if it is possible to load this bc file from a c or c++ program, execute the IR in the bc file with the llvm jit (programmatically in the c program), and get the results. How can I accomplish this? Here's some working code based on Nathan Howell's: #include <string> #include <memory> #include <iostream> #include <llvm/LLVMContext.h> #include <llvm/Target/TargetSelect.h> #include <llvm/Bitcode/ReaderWriter.h> #include <llvm/ExecutionEngine/ExecutionEngine.h> #include <llvm/ModuleProvider.h> #include <llvm

code examples for learning LLVM backend programming

雨燕双飞 提交于 2019-11-28 16:52:03
问题 I am learning programming LLVM backends. Currently I am interested in analysis passes, later program transformations. (I assume as I will be more fluent with analysis then will be time for program transformations). Could you recommend resources for learning ? (I know LLVM Programmers manual and Dragon Book ;) ). By resources I mean not only tutorials, books, but especially small well-written projects . I'd like to read code examples , compile them and play with them (hack a little bit) to

What are the differences between LLVM and java bytecode?

醉酒当歌 提交于 2019-11-28 16:47:44
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. 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 virtual machine. The JVM provides garbage collection, has the notion of objects and virtual method calls

Instrumenting C/C++ codes using LLVM

此生再无相见时 提交于 2019-11-28 16:28:55
问题 I just read about the LLVM project and that it could be used to do static analysis on C/C++ codes using the analyzer Clang which the front end of LLVM. I wanted to know if it is possible to extract all the accesses to memory(variables, local as well as global) in the source code using LLVM. Is there any inbuilt library present in LLVM which I could use to extract this information. If not please suggest me how to write functions to do the same.(existing source code, reference, tutorial,

Static, extern and inline in Objective-C

折月煮酒 提交于 2019-11-28 16:28:51
问题 What do static , extern and inline (and their combinations) mean in Objetive-C using the LLVM compiler? Also, I noticed that there are CG_EXTERN and CG_INLINE macros. Should we be using those instead? (I couldn't find a source with a clear explanation so I thought it might be useful to create one here, or point to it if someone knows one) 回答1: What do static, extern and inline (and their combinations) mean in Objetive-C using the LLVM compiler? The same as in C, unless you compile as ObjC++ -

Is it possible to transform LLVM bytecode into Java bytecode?

最后都变了- 提交于 2019-11-28 15:48:26
问题 I have heard that google app engine can run any programming language that can be transformed to Java bytecode via it's JVM . I wondered if it would be possible to convert LLVM bytecode to Java bytecode as it would be interesting to run languages that LLVM supports in the Google App Engine JVM . 回答1: It does now appear possible to convert LLVM IR bytecode to Java bytecode, using the LLJVM interpreter. There is an interesting Disqus comment (21/03/11) from Grzegorz of kraytracing.com which

Include object file or assembler file in C Project?

时光总嘲笑我的痴心妄想 提交于 2019-11-28 14:39:17
I am playing around a bit bit with Microsofts ELL library/compiler to deploy a simple learning algorithm to a micro controller. But my knowledge regarding embedded development has been better in the past. The Problem is the following: ELL creates an LLVM IR file and a C Header file from a CNTK machine learning model (There are no pure c/c++ files). So far so good. Now I can use the IR to tell llc to make an assembler or object file for the desired target from it (ARM Cortex M4 in my case). So I end up with a header file model.h and an assembler file model.s or an object file model.o . Now I

llvm-gcc assembler: LDR syntax

烂漫一生 提交于 2019-11-28 14:12:09
This code compiles just fine on gcc, but when using llvm (llvm-gcc), it says "constant expression expected" on the line with ldr The problem is the syntax: How do I specify the place where my array is? I do not want to hard-code the displacement in bytes: ldr r7, [pc, #some_shift] but to use a literal to keep the code clean and safe. Any idea how to make it working? .globl func_name func_name: push {r4, r5, r6, r7, r8, r9, sl, fp, ip, lr} //[Some stripped code] add r6, r6, sl, lsl #2 sub ip, ip, sl ldr r7, =maskTable // Here it crashes add sl, sl, #4 @ 0x4 // Some stripped code here mov r0, #0

Is it possible to compile a newer version of LLVM and use it with Xcode?

不想你离开。 提交于 2019-11-28 13:44:09
I have an old computer that cannot upgrade to Lion, but I would like to use it for coding while still taking advantage of syntax such as instancetype and Objective-C literals. Has anyone tried to compile a newer Clang and LLVM to use with an older Xcode and been successful? There are various ways to use the newest LLVM/Clang version. (1) Plugins , as described in the comments above, e.g.: http://blog.wadetregaskis.com/tot-clang-llvm-in-xcode/ As pointed out in the linked blog post, you may get errors/warnings from Xcode's real-time syntax checking as Xcode uses an older version of libclang