3 ms·
LLVM would seem to (maybe? possibly!?) be a good solution, but I was never able to convincingly determine if it was likely to solve my problems, and the docume
by lliiffee 15y ago
LLVM would seem to (maybe? possibly!?) be a good solution, but I was never able to convincingly determine if it was likely to solve my problems, and the documentation seemed to be quite sparse for doing what I wanted to do. (This was a couple years ago, however, and I've love to be proven wrong.)
- sjs 15y agoInstead of generating C code you might be able to generate LLVM IR and have it execute immediately, saved to disk, or both. I don't know how it will perform for you or how high level your generated C is though, it may not be realistic. Or use it to compile your C as it is pretty quick. It's not going to speed things up by orders of magnitude but every bit helps.
- lliiffee 15y agoAwesome. Am I right in understanding that LLVM IR should be LLVM IF or LLVM assembly? The generated code is most extremely simplistic. An example would be: A[12800]=A[0] * A[6400]; A[12801]=A[1] * A[6480]; A[12802]=A[12800] + A[12801]; A[12803]=A[2] * A[6560]; A[12804]=A[12802] + A[12803]; A[12805]=A[3] * A[6640]; Which would be very easy to deal with. The only problem is that I sometimes call out to libraries for exp, log, sin, cos, etc.
- sjs 15y agoThat's right it's a platform independent representation. I think LLVM assembly is really low level, I'm pretty sure you want to generate IR. You should be able to link the math lib. py2llvm looks pretty interesting. http://code.google.com/p/py2llvm/ http://code.google.com/p/py2llvm/ http://code.google.com/p/py2llvm/source/browse/trunk/CodeGenLLVM.py http://code.google.com/p/py2llvm/source/browse/trunk/CodeGen...