[llvm-commits] [RFC] Patch 1/3 for the native code compiler of Erlang

Yiannis Tsiouris gtsiour at softlab.ntua.gr
Fri May 4 11:35:20 PDT 2012


Hi Jakob,

I've been working on this today and I believe it's not going to work. In
detail:

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.

>> 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. But there are some references to it that didn't have an MI
reference available. Such examples are:
* lib/CodeGen/MachineInstr.cpp: getRegClassConstraint
* lib/CodeGen/MachineRegisterInfo.cpp: recomputeRegClass
* lib/CodeGen/SelectionDAG/InstrEmitter.cpp: EmitCopyFromReg
* lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp: GetCostForDef
* lib/Target/Hexagon/HexagonISelDAGToDAG.cpp: SelectIntrinsicWOChain

3) I tried changing some of them (the first two actually) as well but
then (triggered by the avalanche effect :-) i had to change more!

All in all, i believe we should go for something else. I 'm trying to
find a better way to properly do that. Any advice would be welcome!

Best,
Yiannis

-- 
Yiannis Tsiouris
Ph.D. student,
Software Engineering Laboratory,
National Technical University of Athens
WWW: http://www.softlab.ntua.gr/~gtsiour




More information about the llvm-commits mailing list