This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Question about CASE_DROPS_THROUGH (Zack Weinberg)  wrote on 20.06.04 in <>:

> (It should be noted that there are a lot of ports that use the
> "casesi" expander, but in all cases other than VAX there appears to be
> no good reason for this - they're just duplicating what stmt.c would
> do if it had only "tablejump" to work with.  I was particularly
> curious to see if the s390 had a similar instruction to the VAX, but
> if it does we aren't using it.)

I don't remember such an instruction from /370, and I would be surprised  
if it had been added later. (Instead there's this strange "get this other  
instruction, fiddle with the bits in it, then execute it" instruction that  
has never stopped boggling me ...)

But the VAX instruction still looks familiar: UCSD p-Code has something  
that looks extremely close to it - I think I know it as "XJP". Opcode  
followed by lower and upper bound, then by an UJP[1] (unconditional jump)  
instruction that just skips over the case table, then a vector of jump  
targets. (The UJP takes two bytes, as does every jump target - this is a  
16 bit pseudo CPU.)

Just for curiosity, same-procedure code addresses are either referring  
backwards, in which case they are offset-from-address-word, or forward, in  
which case they index a table at the end of the procedure (where there is  
also a struct defining calling sequence and stuff, which is referenced  
from the segment procedure table), and that table will have the offset- 
from-address-word. In fact, *all* actual code pointers are offset-from- 
address-word - everything is PIC. And everything is designed for a strict  
single-pass compiler.

[1] Or presumably one could put some sort of exception thrower there if  
there ever was a compiler for a language where falling through was an  

MfG Kai

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]