[PATCH] D99487: [CodeGen] Port basic block sections from ELF to COFF

Sriraman Tallam via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 18 23:57:46 PDT 2021


tmsriram added a comment.

In D99487#2690528 <https://reviews.llvm.org/D99487#2690528>, @TaoPan wrote:

> In D99487#2690162 <https://reviews.llvm.org/D99487#2690162>, @tmsriram wrote:
>
>> This is quite important to validate the correctness of the generated assembly.  If you could please check that CFI and DebugInfo are sane before we take this patch forward?  Let's get a temperature on how good these are before we decide how to take it forward.
>
> Thanks! I got the importance.
> As for DebugInfo, I tried to add "--basic-block-sections=all" to RUN of llvm/test/DebugInfo/COFF/comdat.ll, text sections includes basic block text sections and CodeViewDebugInfo can be created correctly after
>
> 1. apply this patch
> 2. commenting out a Linux exception handling protocol dependent function which I plan to do in later basic block section Windows exception handling patch.
>
> There are some non-blocking errors "error: all .cv_loc directives for a function must be in the same section" in llc stage,  one error for each basic block, below is the first one.
> f.__part.1:                             # %if.then
> 	#DEBUG_VALUE: f:c <- $ecx
> <unknown>:0: error: all .cv_loc directives for a function must be in the same section
> .Ltmp3:

Would you be able to paste the entire assembly with cv loc directives?  I can try to take a look.

> As for CFI, does it need be verified addition to llvm/test/DebugInfo/ tests? If so, could you please guide me how CFI of basic block sections is verified on Linux?

Basically, this means your code won't assemble with CFI and that is a serious limitation. This is similar to what we did for ELF.  All CFI directives should be within a cfi_startproc  cfi_endproc directive as part of a single section. When you fragment a function into multiple sections, this breaks.  We solved this by adding a separate startproc endproc directive for each section.

I have some suggestions for you to better understand the problem:

- GCC supports function splitting with -freorder-blocks-and-partition.  You can use GCC to split a function and see what it does to cv_loc directives.
- D79978 <https://reviews.llvm.org/D79978>  is what we did with ELF, my guess is it is very similar.  You just need to add a startproc endproc to every function and duplicate all the information to compute Call Frame Address.




Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99487/new/

https://reviews.llvm.org/D99487



More information about the llvm-commits mailing list