Regarding PBQP register allocator not working for X86

Hi All,

I am building LLVM 10.0.1 from source for X86 target, the build completed successfully but when I am compiling using clang(build from source) with “regalloc” flag set to “pbqp”, following error is thrown

“clang (LLVM option parsing): for the --regalloc option: Cannot find option named ‘pbqp’!”

My query is how can I use the pbqp register allocator with clang(build from source) for the X86 target?

Regards,

Siddharth Jain


Disclaimer:- This footer text is to convey that this email is sent by one of the users of IITH. So, do not mark it as SPAM.

+Lang Hames for PBQP questions

The registration of register allocators happens via a global static variable in RegAllocPBQP.cpp. Perhaps because no functions in that function are called from any other file, the file and all its static variables got stripped from the binary?

llc and opt both include LinkAllCodegenComponents.h which has a reference to a PBQP function which makes the file appear live to the linker. clang does not include LinkAllCodegenComponents.h.

PBQP is working with clang installed from apt and clang build from source for AArch64 target but not for X86. Any idea why it could be happening specifically for the X86 target?

It might because AArch64 has a “AArch64PBQPRegAlloc.cpp” which includes “RegAllocPBQP.h”. It should be special only for AArach64, and may not be supported either if you build other target.

For the installed clang, I guess it includes the support for AArch64.

I think a simply workaround is to add AArch64 to your target list by “DLLVM_TARGETS_TO_BUILD=X86;AArch64”

Thanks

Phoebe

Perhaps because no functions in that function are called from any other file, the file and all its static variables got stripped from the binary?

That sounds right to me. If there’s sufficient demand for PBQP support in clang (I’ve never tried to guage it, but I know some groups use it regularly) then we could add a reference to it to clang directly so that it’s always pulled in regardless of the choice of backend(s).