[llvm-bugs] [Bug 42904] New: Print frame index offsets with symbolic labels when outputting verbose assembly

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Aug 6 10:43:42 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=42904

            Bug ID: 42904
           Summary: Print frame index offsets with symbolic labels when
                    outputting verbose assembly
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Common Code Generator Code
          Assignee: unassignedbugs at nondot.org
          Reporter: rnk at google.com
                CC: llvm-bugs at lists.llvm.org

Consider MSVC's assembly output for this program:
https://gcc.godbolt.org/z/wdAp5O
int addit(int x, int y) {
  return x + y;
}

_x$ = 8                                       ; size = 4
_y$ = 12                                                ; size = 4
int addit(int,int) PROC                                    ; addit
        push    ebp
        mov     ebp, esp
        mov     eax, DWORD PTR _x$[ebp]
        add     eax, DWORD PTR _y$[ebp]
        pop     ebp
        ret     0
int addit(int,int) ENDP                                    ; addit

When a local variable offset is used, the compiler prints it using a symbolic
label. The labels are set up prior to the prologue. This should produce the
same object file as using plain integer offsets, but it's way more readable,
which is helpful to any user attempting to understand compiler output. We
should also consider how useful it might be when writing FileCheck tests.

I think we can already put MCSymbols into a MachineOperand, we just need to
make sure that operand can carry an offset, and that anything that runs after
PEI knows how to handle such operands.

It's not clear to me how we'd want to determine the local variable name for an
alloca. Value names are discarded in release builds, but debug info is also not
always present.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190806/7ce6d8ca/attachment.html>


More information about the llvm-bugs mailing list