Port-vax archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Some more patches for GCC on NetBSD/VAX coming soon...



>> 	cmp #42
>> 	beq label
>> 	lda #1
>> 	.byte $2C   ; opcode for a 3-byte instruction that doesn't do much,
>> 		    ; usually the BIT abs instruction that only changes
>> 		    ; condition codes
>> label:	lda #2	    ; a 2-byte instruction

> Ooo.  A tricky way of doing a skip.  I hadn't seen that before.
> Nice.

Yes, a clever hack, indeed.

> However, on, for example a VAX, this is pretty hard to do, as the
> instruction length is not encoded into the opcode.

No...but you might be able to do something similar.  Consider

	.byte	X
	instr	operand, ...

where the opcode for "instr" is an operand specifier, and "instr" takes
one operand fewer than the instruction X is opcode for.  For example,

e1:	.byte	0xd0
e2:	.byte	0x53
	.byte	0x50

If entered at e1, this is "movl r3,r0"; if entered at e2, it's
"tstf r0".  In this case this isn't all that useful, but the basic idea
should be clear.

> I doubt gcc in general would know and use such tricks.

In general?  I should think not!  But the VAX module could in principle
be smart enough to do it.

					Mouse


Home | Main Index | Thread Index | Old Index