[llvm] r280412 - GlobalISel: add a G_PHI instruction to give phis a type.

Quentin Colombet via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 1 15:38:44 PDT 2016

> On Sep 1, 2016, at 3:06 PM, Tim Northover <tnorthover at apple.com> wrote:
>> Which I think I'm OK with really, unless we can come up with a name that really does fit all three cases. I'm working on eliminating some uses of generic regs size at the moment, but after that I'll switch buildCopy to use a new G_COPY.
> Of course, an alternative is to put the entire type information into a MachineRegisterInfo side table instead of on each MachineInstr. Then we could keep COPY, PHI, IMPLICIT_DEF and so on for everything. You need an MRI anyway to look up a register's type.

Given we said we wanted a type for each definition, thus each register, maybe that’s the way to go in the end.
Hmm, I don’t remember why I didn’t want to do it in the first place…
I think the problem was that if you are given a MachineInstr in isolation, you cannot get to its type because you may not have a MRI handy. That’s probably a false problem in the sense that we could have the API enforcing that.

The main impacted component is probably the MachineLegalizerHelper. Do you foresee any problem with that there?

I am OK with the G_COPY as well. The only advantage I can see for having the G_xxx instructions is the save in memory consumption if we stash the information in a variant of MCInstrDesc.


> Tim.

More information about the llvm-commits mailing list