Address and Data register classes with i32 typ - Copy Elimination

Hi there,

I’m writing a backend for an architecture, which has different register classes for address and data with different physical registers. (e.g. Load/Stores and indrect jumps use different register class address operands). The address register class has its own set of arihmetic functions anad I have the problem, that I can’t select those in DAGtoDAGISel because the value type is the same as for the data registers. (i32)

So problem is, that I get a lot of register class copies, which create actual move instruction but could be replaced by a different instruction. For example:

dclass = copy aclass
dclass = add dclass imm
aclass = copy dclass

Can be done as aclass = add_a aclass imm. Most of the important arithmetic instructions exists with data register or with address registers, and even some mixing.

I have a few questions:

  • Is there a way to help cope with that in DAGtoDAGIsel already?
  • Is there some infrastructure in place to help me with this task?
  • I’m thinking about a PreRegAlloc pass. Is this the right place?

BR,

go2sh