<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi Xiangyang,<div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On May 8, 2015, at 1:02 PM, Xiangyang Guo <<a href="mailto:xguo6@ncsu.edu" class="">xguo6@ncsu.edu</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Hi,<div class=""><br class=""></div><div class="">My question sounds kind of silly, but can we define a physical register for both integer and floating point in LLVM backend?</div><div class=""><br class=""></div><div class="">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. </div></div></div></blockquote><div><br class=""></div><div>I’m not sure what you mean here.</div><div>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:</div><div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class="">def FPR32 : RegisterClass<"AArch64", [<span style="font-variant-ligatures: no-common-ligatures; color: #ffffff; background-color: #000000" class="">f32</span>, i32], 32,(sequence "S%u", 0, 31)>;</div></div><div><br class=""></div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><br class=""></div><div class="">And what if my backend does not have floating point physical register, but my IR has floating point virtual register?</div></div></div></blockquote><div><br class=""></div><div>You need to use a soft-float library.</div><div><br class=""></div><div>Cheers,</div><div>Q.</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><br class=""></div><div class="">Thanks</div><div class=""><br class=""></div><div class="">Xiangyang </div></div>
_______________________________________________<br class="">LLVM Developers mailing list<br class=""><a href="mailto:LLVMdev@cs.uiuc.edu" class="">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" class="">http://llvm.cs.uiuc.edu</a><br class=""><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" class="">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br class=""></div></blockquote></div><br class=""></div></body></html>