made up byte code: registers vs. literals

jklein@freon.artificial.com (jon klein)
24 Nov 1996 16:25:22 -0500

          From comp.compilers

Related articles
made up byte code: registers vs. literals jklein@freon.artificial.com (1996-11-24)
Re: made up byte code: registers vs. literals bear@sonic.net (Ray S. Dillinger) (1996-12-01)
Re: made up byte code: registers vs. literals cliffc@risc.sps.mot.com (1996-12-03)
Re: made up byte code: registers vs. literals kaleja@rahul.net (Russell Bornsch++) (1996-12-03)
| List of all articles for this month |

From: jklein@freon.artificial.com (jon klein)
Newsgroups: comp.compilers
Date: 24 Nov 1996 16:25:22 -0500
Organization: University of Massachusetts, Amherst
Keywords: interpreter, comment

Hey there,
I've got a specific question, part of a much larger general one.
I've created my own simple byte codem specificially meant to do some
mathematical operations, and little more (no memory access, function calling,
etc... just straight math).


The interpreter has a couple of virtual registers to store intermediate
results. The was I'm doing it, each 8-bit operator has 3 8-bit operands,
so that each instruction is 32 bits wide.


ADD %r1,%r2,%r3 ; r3 = r1 + r2


The problem deals with literals. Say I want to:


ADD 5, %r2, %r3


or the more important problem


MOV 10, %r1




The general question then, is: how does the Sparc (or any... I'm just
familiar with Sparc) assembler handle this? It's perfectly legal to say
'mov 40, %l0'. When assebled, how is this supposed to look? How is the
distinction made between register X, and literal X?


Any help is appriciated!


--
-jon klein
jklein@freon.artificial.com
[There's typically separate op codes for "move register to register" and
move "literal to register". Alternatively there may be type bits per operand
like the Vax used. -John]
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.