Hacker News new | past | comments | ask | show | jobs | submit login

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.)



Instead 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.


Awesome. 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.


That'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/source/browse/trunk/CodeGen...




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: