[LLVMdev] getMinimalPhysRegClass

reed kotler rkotler at mips.com
Mon May 14 15:22:24 PDT 2012


On 05/14/2012 02:42 PM, Jakob Stoklund Olesen wrote:
> On May 14, 2012, at 2:28 PM, reed kotler wrote:
>
>> I'm not using getMinimalPhysRegClass. Some target independent code is using it.
> Probably PEI.
>
>> It makes trouble for us and I would like to submit a patch to make it a virtual function so that I can override it and make it meaningful for Mips, as long as this method still exists.
>>
>> I want to add another register class for Mips16 and don't want to define a Mips16 set of registers because in reality there is no such thing; MIPS16 is an application extension that can exist for either Mips32 or Mips64 which uses a different instruction encoding.
>>
>> When I'm compiling for -mips23 -nomips16 I don't want the mips16 register class being passed to any functions which take such a register class parameter.
>>
>> As it is right now, it sees mips16 as the minimal size class and passes it when I'm compiling for -mips32 -nomips16
> The ARM tGPR register class is the same. It has no business showing up in non-Thumb code, but it is completely harmless when it does.
>
> My best advice to you is don't try to swim upstream. The Liskov substitution principle for register classes is deeply ingrained in the LLVM register allocators.
>
> /jakob
>
If I submit this patch, is it going to be rejected:

iff --git a/include/llvm/Target/TargetRegisterInfo.h 
b/include/llvm/Target/Targ
index 7e73db3..2262715 100644
--- a/include/llvm/Target/TargetRegisterInfo.h
+++ b/include/llvm/Target/TargetRegisterInfo.h
@@ -298,7 +298,7 @@ public:
    /// getMinimalPhysRegClass - Returns the Register Class of a physical
    /// register of the given type, picking the most sub register class of
    /// the right type that contains this physreg.
-  const TargetRegisterClass *
+  virtual const TargetRegisterClass *
      getMinimalPhysRegClass(unsigned Reg, EVT VT = MVT::Other) const;

    /// getAllocatableClass - Return the maximal subclass of the given 
register
(

???





More information about the llvm-dev mailing list