There are already methods in backend/asm.js for generating immediate integer values (up to 64 bits wide and in either big-end or little-end format). The methods are
gen8 gen16 gen16BE gen16LE gen32 gen32BE gen32LE gen64 gen64BE gen64LE
Those methods currently use right shifts and bitwise-and to extract the appropriate bytes. I have rewritten them to use the num type instead.
Is that sufficient?
Marc
On 2011-02-14, at 2:37 PM, chevalma@iro.umontreal.ca wrote:
The use would be to write immediate integer values (8, 16, 32, 64 bits in 2s complement) when generating code in the backend. At some point we need to be able to generate the machine-representation of those values.
I'm not sure how exactly it's handled right now. Erick has an address/pointer class with a getBytes() method. Constants have a getImmValue() method which simply returns a JavaScript number at the moment (which doesn't work for 64 bit integer values). This will need to change, and ideally be unified into one mechanism.
- Maxime
On 2011-02-14, at 2:28 PM, chevalma@iro.umontreal.ca wrote:
Marc, if you have time, I think it might be quite useful for the back-end to have a function to convert a bignum/num to an array of byte values.
Please explain exactly what you want (there are many variations possible). Where in the source can I find a use for this?
Marc
Tachyon-list mailing list Tachyon-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/tachyon-list
Tachyon-list mailing list Tachyon-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/tachyon-list