[Oberon] Numerical CASE Statements in Project Oberon
Jörg Straube
joerg.straube at iaeth.ch
Sun Oct 23 10:26:28 CEST 2016
Yes.
The compiler uses the instruction Put3(BR, 7, reg) eg for returns from procedures.
Jörg
Am 23.10.2016 um 05:46 schrieb Chris Burrows <chris at cfbsoftware.com>:
>> -----Original Message-----
>> From: Chris Burrows [mailto:chris at cfbsoftware.com]
>> Sent: Saturday, 7 November 2015 11:33 PM
>> To: ETH Oberon and related systems (oberon at lists.inf.ethz.ch)
>> Subject: Numerical CASE Statements in Project Oberon (was: [Oberon]
>> RISC.img)
>>
>>>
>>> From: Oberon [mailto:oberon-bounces at lists.inf.ethz.ch] On Behalf Of
>>> Jan de Kruyf
>>> Sent: Friday, 6 November 2015 8:37 PM
>>> To: Paul Reed; ETH Oberon and related systems
>>> Subject: Re: [Oberon] RISC.img
>>>
>>> 2. Question:
>>> I see that the 'numerical' CASE implementation is missing in
>> ORP.Mod,
>>> although it is in the language spec and although we might
>> reasonably
>>> expect people to port programs from O2 to O7.
>>>
>>> Would it be in the interest of the community for me to try and
>>> implement that part, at least for constant labels?
>>>
>>
>> Don't even think about implementing it unless you are planning to do
>> it properly - a half-baked solution would be worse than none. e.g. I
>> would expect a complete solution to include the implementation of a
>> RISC6 (or RISC5.1 maybe?) processor which has indexed-branch
>> statements.
>>
>
> I have now implemented a numerical CASE statement in Astrobe for Embedded Project Oberon for compatibility with the Oberon compiler used in Astrobe for the ARM-Cortex targets.
>
> I was wrong about the RISC5 processor instruction set. It does not need any additional instructions in order to be able to implement an efficient branch table-driven numerical CASE statement. It already has a branch instruction that sets the address of the next instruction to be the value of a register. The index into the jump table can be computed and stored in that register.
>
> Apologies for any confusion,
>
> Regards,
> Chris
>
> Chris Burrows
> CFB Software
> http://www.astrobe.com/RISC5
>
>
>
>
> --
> Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
> https://lists.inf.ethz.ch/mailman/listinfo/oberon
More information about the Oberon
mailing list