Simplistic Backend

Hi!

I'm working on a project that aims to do very cheap verification of
generic computations on blockchains (specifically Ethereum).
For that, I would like to compile complex code (think of hash functions
or key derivation functions) into a very simplistic architecture for
which it is trivial to write an interpreter.
An architecture like TinyRAM [1] would be ideal, i.e. it has the usual
arithmetic and logical operations on registers, conditional jumps and
memory read- and write access only via specific instructions (although
this is not too important).
Is there an llvm backend that comes close to that? If not, how hard is
it to implement such a backend?
Oh and by the way, brainfuck might also be a suitable architecture :slight_smile:

Thanks,
Christian.

[1]: http://www.scipr-lab.org/doc/TinyRAM-spec-0.991.pdf

Good timing, Christian!

We're now in the process of upstreaming a very simple backend for a
processor with similar characteristics (integer registers, register-memory
operations) and enough power to run C++. Here's the email with links to
patches: http://lists.llvm.org/pipermail/llvm-dev/2016-February/095118.html

The backend is now being reviewed - its ISA is described in comments in the
Tablegen file contained in the backend patch
Feel free to take a look and leave comments
Eli