question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Alignment should account for long instruction names

See original GitHub issue

Usually, the assembly output is aligned using spaces on the first argument, e.g.:

        mov     rcx, qword ptr [r8 + rax + 32]
        imul    rcx, qword ptr [rdx + rax + 32]
        add     rcx, qword ptr [rsi + rax + 32]

However, when the compilers generate instructions with very long names, the alignment is not pushed rightwards to accommodate for these, and we get, for example:

        vmovsd  xmm0, qword ptr [rdx + rax + 32] # xmm0 = mem[0],zero
        vmovsd  xmm1, qword ptr [rcx + rax + 32] # xmm1 = mem[0],zero
        vfmadd213sd     xmm1, xmm0, qword ptr [rsi + rax + 32]
        vmovsd  qword ptr [rdi + rax + 32], xmm1

which is kind of ugly and less readable. Now, assuming the user has not enabled \s+, I believe the arguments should be aligned by ensuring there’s enough space.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
mattgodboltcommented, Mar 14, 2018

I agree it’d be lovely to fix this. GCC and clang only put a single tab between instructions and their operands, which means as soon as an instruction is 8 or more characters long, the indent doesn’t work. We can of course parse the instructions, and re-flow them, but then all instructions would be super-indented to account for a single very long instructions. I think this is why the compilers stick to a single tab character, instead of using two or more. I guess we could treat tabs as being (say) 12 characters long which I think covers all current x86 instructions…

0reactions
RubenRBScommented, Nov 2, 2022

Thanks for taking the time to check this issue, let us know if you find any other problem where we can help 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Align Assessments, Objectives, Instructional Strategies
Why should assessments, learning objectives, and instructional strategies be aligned? ... Assessments should reveal how well students have learned what we want ...
Read more >
Data structure alignment
Data structure alignment is the way data is arranged and accessed in computer memory. It consists of three separate but related issues: data...
Read more >
Structure Member Alignment, Padding and Data Packing
Data Alignment: Every data type in C/C++ will have alignment requirement (infact it is mandated by processor architecture, not by language). A ...
Read more >
Assembly - Do instructions have to be aligned even in ...
Instructions always need to be word aligned for addressing reasons. Therefore, instructions that are half, quarter, double or triple the actual ...
Read more >
Alignment Requirement - an overview | ScienceDirect Topics
There are three types of alignment requirements, which are given as follows: •. transmitter alignment. •. receiver alignment. •. receiver-to-transmitter ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found