Questions tagged [llvm-py]

llvmpy is a Python wrapper around the LLVM C++ library.

llvmpy is a Python wrapper around the llvm C++ library which allows simple access to compiler tools.

13 questions
6
votes
2 answers

Call Python code from LLVM JIT

I write a language lexer/parser/compiler in python, that should run in the LLVM JIT-VM (using llvm-py) later. The first two steps are quite straightforward for now, but (even if I didn't start the compile-task yet) I see a problem, when my code…
KingCrunch
  • 128,817
  • 21
  • 151
  • 173
5
votes
2 answers

Building and running llvm-py on Mac OS X

I was trying to build llvm-py on Mac OS X. This is what I tried to do, I needed to download 11vm-2.7, and the README file has this comment: Make sure '--enable-pic' is passed to LLVM's 'configure' Download llvm 2.7. Build llvm 2.7: Run ./configure…
prosseek
  • 182,215
  • 215
  • 566
  • 871
1
vote
1 answer

Adding a new LLVM target to llvmlite

Is it possible to add a new target to llvmlite (python library)? For a new hardware (e.g. ASIC), I need to have a new and custom LLVM target. This is not very clear from the documentation. If it is not possible to add a new target in llvmlite, can I…
Roy
  • 65
  • 2
  • 15
  • 40
1
vote
1 answer

Playing with llvm-py

I was trying to get llvm-py to install on my OSX 10.9 and I got the following error when trying to install it. % python setup.py build Error: could not invoke ['llvm-config', '--version'] Try setting LLVM_CONFIG_PATH=/path/to/llvm-config However, I…
user277465
1
vote
1 answer

Why does LLVM throw an "arguments of incompatible type" error when creating an array?

I am using LLVM and the llvmpy library. My goal is to create something similar to the follow C code: int a[] = {1, 2}; int b[] = {1, 2, 3}; int c[] = {1}; int* ptrs[] = {a, b, c}; The following is the outputted IR of the above excerpt: %1 = alloca…
sdasdadas
  • 23,917
  • 20
  • 63
  • 148
1
vote
1 answer

How do I hold an array of pointers in LLVM?

For some background, I am implementing a compiler using the llvmpy library which is a wrapper around the LLVM IR generation. I have created a character type which represents one or more UTF-8 code points. These code points are stored in an array so…
sdasdadas
  • 23,917
  • 20
  • 63
  • 148
1
vote
1 answer

How do I write output from within Python's LLVM bindings?

I am using Python's LLVM bindings to generate code for a custom language. Now I want to run programs and check if their output works correctly - but I am unable to figure out exactly how to output anything. Is there some way to write to stdout or to…
sdasdadas
  • 23,917
  • 20
  • 63
  • 148
1
vote
1 answer

Is possible to load a function from *any|some* llvm generated code in iOS (not made by clang)?

If I build a function with LLVM, like int sum(int a, int b) { return a + b; } using something like http://www.llvmpy.org/llvmpy-doc/dev/doc/firstexample.html, is possible to use that function from inside iOS? as if was a function made with…
mamcx
  • 15,916
  • 26
  • 101
  • 189
1
vote
1 answer

How can I 'transform' Class object in python to llvm?

I am willing to use llvm to optimize my python code. I read some tutorials but I have not figured out how to, let's say, export class object from the python code to llvm. I learnt how to create a function in llvm-py, but classes are beyond my…
Jendas
  • 3,359
  • 3
  • 27
  • 55
0
votes
0 answers

How can I include library functions from assembly files in my compiler using llvmpy?

I have to include some functions, that I have implemented in 8086 assembly, in my compilers project for a C-like programming language. That is, I have 6 .asm files. I have used so far llvmpy (a no longer maintained python tool, but still more…
ddaedalus
  • 131
  • 5
0
votes
1 answer

Cannot install llvmpy "can't open file 'llvmpy/build.py'"

I have some trouble installing llvmpy on ubuntu 14.04, i downloaded llvmpy from llvmpy.org and installed llvm 3.4 via apt-get, when I try to install it using python setup.py install I get this error: Error: could not invoke ['llvm-config',…
0
votes
1 answer

How do I pass an array pointer to a function in LLVM / llvmpy?

I am using llvmpy to (attempt to) generate IR code. However, I am stuck using printf and an array of int8. The following is an excerpt of what is giving me issues: # Defining the print function. # ----- fntype = Type.function(Type.void(),…
sdasdadas
  • 23,917
  • 20
  • 63
  • 148
0
votes
1 answer

How do I store a value in LLVM?

I am using LLVM's Python bindings - and, so far, I've been able to generate Constant values using LLVM. However, I am confused as to how to store them within an address. This is probably a very basic question - how do I store a constant in memory?…
sdasdadas
  • 23,917
  • 20
  • 63
  • 148