I have written a simple nested macro in LLL, but I can't get it to reduce to the simplest expression when calling the compiler with the optimization option. My macro looks like this:
(def 'mcopy (pos loc length) (codecopy (sub (mul pos 0x2) length) loc length))
Reading the LLL compiler documentation, it seems as though invocation of the above with constants should produce a reduced assembly expression with constants, like
codecopy(x, b, c), and not
codecopy(sub(mul(a, 0x2), c), b, c) as I see in the disassembled bytecode. I've read elsewhere that not all optimizations are guaranteed to occur, but I was wondering if there was a simple way to fix this, aside from writing my own preprocessor on the
.lll source code.