This is the mail archive of the gcc@gcc.gnu.org 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: Different addressing modes?


>I am still trying to get addressing modes correctly in my port. Basically my 
>architecture has the following addressing modes:
>
>  1) absolute
>  2) register indirect
>  3) register + offset
>  4) register + register

You may want to go back and read the Compiler internals documentation
where it talks about 'predicate' functions (such as general_operand,
nonimmediate_operand' that you can use to fine-tune what RTL the insns
patterns your port will accept.

As an example, in gcc/config/m68k/m68k.md, the 'pushasi' pattern is
used to push the address of a varaible/function, etc, and you can see
that the destination target predicate of the 'set' is push_operand
which restricts the RTL to only allow a push to the stack as the
destination, and specifies that the source of the 'set' is an
address_operand, a combination of predicates that are valid for the
pea instruction:

(define_insn "pushasi"
  [(set (match_operand:SI 0 "push_operand" "=m")
	(match_operand:SI 1 "address_operand" "p"))]
  ""
  "pea %a1")


-- 
Peter Barada                             Peter.Barada@motorola.com
Wizard                                   781-852-2768 (direct)
WaveMark Solutions(A Motorola Company)   781-270-0193 (fax)


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