Home
Prox / RFID
Verichips
Ladder Logic
[interfacing] †
Tube Joints
Key Code From Photo
SolveSpace (3d CAD)
SketchFlat (2d CAD)
Photographs
Miscellany
Resume / Consulting
Contact Me

LDmicro Forum - ldinterpret.c - intcode.h

(you are viewing a thread; or go back to list of threads)

ldinterpret.c - intcode.h (by BoumPower)
Think that code will be more efficient by adding some primitive :
INT_SET_VARIABLE_ADD_LITERAL (V1 = V2 + literal)
INT_SET_VARIABLE_SUB_LITERAL (V1 = V2 - literal)
INT_SET_VARIABLE_LITERAL_SUB (V1 = literal - V3)

and so more with multitly, divide, if....

For example, the two less significants bits of the INT codes (intcode.h) could specify if name2/name3 refer to variable or literal ? :
INT_SET_VARIABLE_ADD 0b00001100 // V2+V3
INT_SET_VARIABLE_ADD_LITERAL 0b00001101 // V2 + literal
INT_SET_VARIABLE_LITERAL_ADD 0b00001110 // literal + V3
INT_SET_VARIABLE_ADD_NOSENSE 0b00001111 // literal + literal

this coding leave 64 opcode in byte size

having efficient intermediate code will allow efficient VM machine on MCU
Mon Jan 25 2010, 07:28:25
(no subject) (by Jonathan Westhues)
It's a tradeoff between efficiency and ease of implementation. There are many other intermediate code ops that would improve the efficiency and code size if they existed; but that would add complexity to all of the back ends, so I have chosen not to do so.

Of course, if you don't like the code that LDmicro generates, then the source code is available for download. So you are free to make whatever changes you prefer.
Mon Jan 25 2010, 10:42:51
Post a reply to this comment:
Your Name:
Your Email:
Subject:
(no HTML tags; use plain text, and hit Enter for a line break)
Attached file (if you want, 5 MB max):