Hi,

I'm trying to port GCC to a simple processor (used only for academic
purposes, yet).

Problem: no immediate-values are supported in the instructions.
How can I tell the compiler to put all immediates into the memory, and
use the corresponding reference instead of the value itself?
so, instead of

move REG,5

I would like to have

move REG,const5
…
; and somewhere else
const5: .word 5

My approach would be, to use a define_expand statement like this:

 (define_expand "movhi"
   [(set (match_operand:HI 0 "general_operand" "")
        (match_operand:HI 1 "general_operand" ""))]
   ""
   "
 {
   /* we are not able to use immediates, so put them to memory  */
   if (CONST_INT_P (operands[1]))
     operands[1] = force_const_to_memref (HImode, operands[1]);
 }")

But HOW can I force the operand into memory?
I.e. "force_const_to_memref" needs to be defined somehow.
Any hints?

Thanks a lot!
Hagen

Reply via email to