On Wed, Jul 19, 2006 at 09:44:12AM +0100, [EMAIL PROTECTED] wrote: > We are trying to write a new backend for GCC. The target machine is > 16-bit, with 24-bit pointers. However, the indexed addressing mode has a > 24-bit base and a 16-bit index, so we want to generate RTXs such as > > (mem:QI (plus:SI (reg:HI <index>) > (reg:SI <base>))) > > (mem:HI (plus:SI (mult:SI (reg:HI <index>) > (const_int 2)) > (reg:SI <base>))) > > But I've not managed to get this to work reliably.
You are not making it easy to help you. Please tell us what makes you conclude that it isn't working reliably (error messages, code which is slower and/or larger than expected, etc) and how you tried to make it work, such as: Your definition of GO_IF_LEGITIMATE_ADDRESS() and TARGET_ADDRESS_COST(), if any. I would imagine that you need some (zero_extend ...) expressions and also to use PSImode for pointers. Your second example above would then look like (mem:HI (plus:PSI (mult:PSI (zero_extend:PSI (reg:HI <index>)) (const_int 2)) (reg:PSI <base>))) (Some target machines use zero extension and others use sign extension, please adjust accordingly.) > Can this be done > relatively painlessly? Also, we are currently working on a gcc 3.4 branch; > are there any changes in gcc 4.x which would make this easier? Starting with GCC 4.2, maybe this one: <URL:http://gcc.gnu.org/ml/gcc-patches/2006-03/msg01311.html>. On <URL:http://gcc.gnu.org/lists.html>, please read the part which follows: "Please do not include or reference confidentiality notices". -- Rask Ingemann Lambertsen