[LLVMdev] can we define a physical register for both integer and floating point

Quentin Colombet qcolombet at apple.com
Fri May 8 15:09:45 PDT 2015


Hi Xiangyang,

> On May 8, 2015, at 1:02 PM, Xiangyang Guo <xguo6 at ncsu.edu> wrote:
> 
> Hi,
> 
> My question sounds kind of silly, but can we define a physical register for both integer and floating point in LLVM backend?
> 
> In the section "Defining a Register Class" in tutorial "Writing an LLVM Backend", when we define a Register Class, we need to define the regType, which makes sense to me. But if both integer and floating point are 32 bits, why cannot we use a physical register to represent different types of numbers accordingly. 

I’m not sure what you mean here.
For a register class to handle different types is perfectly fine, e.g., on AArch64 both i32 and f32 can live in the same class:
def FPR32 : RegisterClass<"AArch64", [f32, i32], 32,(sequence "S%u", 0, 31)>;


> 
> And what if my backend does not have floating point physical register, but my IR has floating point virtual register?

You need to use a soft-float library.

Cheers,
Q.

> 
> Thanks
> 
> Xiangyang 
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150508/0bfac439/attachment.html>


More information about the llvm-dev mailing list