On 20 May 2013 22:45, Andreas Färber <[email protected]> wrote: > Am 20.05.2013 23:33, schrieb Peter Maydell: >> On 20 May 2013 21:57, Andreas Färber <[email protected]> wrote: >>> - TARGET_BASE_ARCH in Makefile.target is assumed to be the name of the >>> target-* subdirectory, but this will not always be desirable. >> >> Isn't it the name of the target-* subdirectory by definition? >> (ie we need to be able to set that somehow if you have a subarch >> that's piggybacking on another subarch, and this is how we set it). > > The base architecture is by definition the architecture another one is > basing on. The base architecture's define is present for all derived > ones (e.g., TARGET_PPC for TARGET_PPC64).
Yes; the architecture you're basing on is the one whose target-foo directory you're using. That's what using another architecture as the base architecture means. Actually, I looked at your code and I couldn't immediately see why we need two targets at all here. The current in-tree uses of TARGET_BASE_ARCH are: * 64 bit extensions to 32 bit CPUs, so TARGET_LONG_BITS in particular needs to be different * different ABI variants for linux-user It looks like both of these cpu families are less-than-32-bit so maybe we could make them runtime cpu choices in a single target executable? >> It seems to me that if you're going to put the source code in >> the target-rl78 directory you should make rl78 the >> TARGET_BASE_ARCH. Alternatively call the directory target-78k0 >> if you want the TARGET_BASE_ARCH to be 78k0. > > I tried that and it is awful for two reasons: > * 78k0 is not a valid identifier in C, so I can't write 78k0_cpu_foo. This is true, but it's going to be a problem to be dealt with if we care about 78k regardless of how we structure it relative to rl78. > * I only care about implementing RL78 but I know it has a documented > base architecture of 78K/0 that I would like to mark up to avoid the > issues we have with implementing older ARM versions after the fact. The problems ARM has with implementing older versions are mostly that (a) v5-only stuff wasn't explicitly marked when we coded it (b) v4-only semantics weren't implemented (and to some extent (c) nobody cares enough about the v4 stuff to do the implementation and test it). This doesn't have any particular relevance to naming. The Renesas website seems to say the family name is just '78K', not '78K0', incidentally. Two suggestions: * call it r78k to go with i386 and m68k * just call it rl78 as the "modern" name and have the 78k cores be part of that (in the same way that if we implemented a 286 we'd put it in target-i386) But I really do think that flipping the base and not-base names around is going to be confusing. We're in the middle of this conversation so the concept is fresh in my mind, but I still read translate.c and thought "why the heck is the rl78 translate.c doing #ifdef TARGET_RL78, that's always true". thanks -- PMM
