llvm

Adding a function call in my IR code in llvm

岁酱吖の 提交于 2019-11-28 22:34:23
问题 Can you give me an example ,how to add a simple call of a function foo(x); on my IR code with my pass in llvm? 回答1: A simple way is to learn is to use ELLCC with Output Options as LLVM C++ API Code . Two key notes: Make sure foo 's definition is available; otherwise you need to define it firstly. Typically you need to get the prototype by using getOrInsertFunction and then use IRBuilder to insert the body for the function. Create the CallInst , an easy way is to use CallInst*IRBuilder:

xcode LLVM 5.1 clang error

北城以北 提交于 2019-11-28 21:38:24
I am having no luck the last few days since Xcode 5.1 came out. I keep getting this error on an old project that supports iOS 6.0: ERROR: clang: error: unknown argument: '-fno-obj-arc' [-Wunused-command-line-argument-hard-error-in-future] clang: note: this will be a hard error (cannot be downgraded to a warning) in the future Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1 There are not many posts about this on the internet and some suggestions seem to be to change your CFLAGS but I have no idea how to do that in

In Xcode project target build settings, What is Mach-O Type?

风流意气都作罢 提交于 2019-11-28 21:18:16
问题 After getting tired of numerous Match-O linker error, I want to know that this thing means. Instead of trial and error solution, I would like to know the concept behind these things. Specifically I want to know the difference between : Executable Dynamic Library Bundle Static Library Relocatable Object File These are the options presented when I click on Mach-O Type settings on Linking section. Some small definition or some link to appropriate content is ok too. 回答1: Mach-O, short for Mach

Adding Metadata to Instructions in LLVM IR

血红的双手。 提交于 2019-11-28 21:16:14
问题 First up, I am a newbie to LLVM passes. I am trying to add metadata to instructions in LLVM after a transformation pass (with the C++ API). I intend to store this information for use by another tool in a tool chain. I have two questions regarding this. I expect the information I store as metadata to feed into another tool which works on the LLVM IR. So is metadata a good idea ? I intend to store strings as metadata with some instructions. If metadata is the right way to go here, I need some

Are llvm-gcc and clang binary compatible with gcc? - particularly mingw gcc on Windows

妖精的绣舞 提交于 2019-11-28 20:19:38
If I build a static library with llvm-gcc, then link it with a program compiled using mingw gcc, will the result work? The same for other combinations of llvm-gcc, clang and normal gcc. I'm interested in how this works out on Linux (using normal non-mingw gcc, of course) and other platforms as well, but the emphasis is on Windows. I'm also interested in all languages, but with a strong emphasis on C and C++ - obviously clang doesn't support Fortran etc, but I believe llvm-gcc does. I assume they all use the ELF file format, but what about call conventions, virtual table layouts etc? Yes, for C

Parsing and Modifying LLVM IR code

末鹿安然 提交于 2019-11-28 19:43:16
I want to read (parse) LLVM IR code (which is saved in a text file) and add some of my own code to it. I need some example of doing this, that is, how this is done by using the libraries provided by LLVM for this purpose. So basically what I want is to read in the IR code from a text file into the memory (perhaps the LLVM library represents it in AST form, I dont know), make modifications, like adding some more nodes in the AST and then finally write back the AST in the IR text file. Although I need to both read and modify the IR code, I would greatly appreciate if someone could provide or

How to detect LLVM and its version through #define directives?

别等时光非礼了梦想. 提交于 2019-11-28 19:30:32
问题 The question is quite clear I think. I'm trying to write a compiler detection header to be able to include in the application information on which compiler was used and which version. This is part of the code I'm using: /* GNU C Compiler Detection */ #elif defined __GNUC__ #ifdef __MINGW32__ #define COMPILER "MinGW GCC %d.%d.%d" #else #define COMPILER "GCC %d.%d.%d" #endif #define COMP_VERSION __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__ #endif Which could be used like this: printf("

Is there a llvm java front end that converts java source to llvm's intermediate form?

淺唱寂寞╮ 提交于 2019-11-28 18:07:33
From what I've read, there is a llvm program that converts java bytecode to llvm's intermediate form called class2llvm. My question is, how do I access this. What front end do I have to install in order to access this. VMkit is their implementation of a JVM, but I am looking for how to compile the java source code with llvm, not how to run it. The Java frontend translates Java bytecode (.class files) into LLVM bytecode. Take a look at this link: https://llvm.org/svn/llvm-project/java/trunk/docs/java-frontend.txt lei_z You may take a look at dragonegg , which enables llvm to use gcc's frontends

llvm ir back to human-readable source language?

空扰寡人 提交于 2019-11-28 17:38:41
Is there an easy way of going from llvm ir to working source code? Specifically, I'd like to start with some simple C++ code that merely modifies PODs (mainly arrays of ints, floats, etc), convert it to llvm ir, perform some simple analysis and translation on it and then convert it back into C++ code? It don't really mind about any of the names getting mangled, I'd just like to be able to hack about with the source before doing the machine-dependent optimisations. There is an issue here... it might not be possible to easily represent the IR back into the language. I mean, you'll probably be

Clang on Windows

有些话、适合烂在心里 提交于 2019-11-28 17:33:42
First of all, I've followed "Getting Started: Building and Running Clang" . In particular, I've built it according to "Using Visual Studio" section. In other words, I've built it using Visual Studio 2010. Secondly, I've manually set include and library paths to MinGW distribution: The simple program I'm trying to compile: #include <iostream> using namespace std; int main() { cout << "Hello, World!" << endl; return 0; } I get the following feedback from the compiler: In file included from C:\MinGW\lib\gcc\mingw32\4.5.2\include\c++\iostream:39: In file included from C:\MinGW\lib\gcc\mingw32\4.5