[llvm-commits] [RFC] Patch 1/3 for the native code compiler of Erlang
Jakob Stoklund Olesen
stoklund at 2pi.dk
Sat May 5 10:37:49 PDT 2012
On May 4, 2012, at 11:35 AM, Yiannis Tsiouris wrote:
> On 05/03/2012 05:52 PM, Jakob Stoklund Olesen wrote:
>> Yes, except the MI part was a thinko. It should just be an MF reference:
>>
>> virtual const TargetRegisterClass *getPointerRegClass(const MachineFunction &MF, unsigned Kind=0) const;
> Using an MI reference might be more clear as MI is almost everywhere
> available. That's why i preferred it.
It should be an MF because the result should not be allowed to depend on which instruction you are passing in.
>>> Furthermore, to do this properly I should change the interface of
>>> getPointerRegClass target hook in all Targets and the usage of it by
>>> changing TRI->getPointerRegClass() wherever needed, right?
>> Yes, and it looks like you will have to add the same MF argument to TargetInstrInfo::getRegClass().
>>
>> If you find any places that call TII->getRegClass() without having an MF reference available, we may have to find a different solution.
> This *almost* thing is what makes me worried. I tried to implement this
> as follows:
>
> 1) Changed getPointerRegClass definition to match:
>
> virtual const TargetRegisterClass *getPointerRegClass(const MachineFunction &MF, unsigned Kind=0) const;
>
> 2) I also had to change getRegClass from TargetRegisterInfo as you
> suspected.
You mean TargetInstrInfo::getRegClass(), right?
> But there are some references to it that didn't have an MI
> reference available.
These callers all have an MF reference available:
> Such examples are:
> * lib/CodeGen/MachineInstr.cpp: getRegClassConstraint
getParent()->getParent() (You can assert if either is NULL).
> * lib/CodeGen/MachineRegisterInfo.cpp: recomputeRegClass
Doesn't call TII::getRegClass() directly.
> * lib/CodeGen/SelectionDAG/InstrEmitter.cpp: EmitCopyFromReg
*MF
> * lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp: GetCostForDef
Just add an MF argument.
> * lib/Target/Hexagon/HexagonISelDAGToDAG.cpp: SelectIntrinsicWOChain
*MF
The last function also demonstrates why using an MI pointer won't work: There aren't any available in SelectionDAGISel.
/jakob
More information about the llvm-commits
mailing list