Skip to content

[MC] Remove unused MCAsmBackend::isMicroMips() method (NFC) #135581

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 14, 2025

Conversation

s-barannikov
Copy link
Contributor

The only use was removed by 4c89277.

@s-barannikov s-barannikov requested a review from MaskRay April 14, 2025 02:17
Copy link
Member

@MaskRay MaskRay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@s-barannikov s-barannikov merged commit 7778a19 into llvm:main Apr 14, 2025
12 checks passed
@s-barannikov s-barannikov deleted the mc/rm-unused-micro-mips-method branch April 14, 2025 03:20
@MaskRay
Copy link
Member

MaskRay commented Apr 14, 2025

(I will have limited internet access between April 20th and May 4th, and my response time may be delayed..)

(Made some notes about microMIPS. LLVM's support is quite lacking.

In MIPS16 and microMIPS modes, text labels are marked with the STO_MIPS_MIPS16 or STO_MIPS_MICROMIPS bit, and their addresses have bit 0 set.
This affects how labels and their differences are handled in assembly code.

Consider the following example:

B0 = .
B1:
  move    $25,$4
C0 = .
C1:
  move    $25,$4
.data
.long C0-B0, C1-B0, C0-B1, C1-B1   // gas Output: 2, 3, 1, 2
.long B0, B1, C0, C1               // gas Output: 0, 1, 2, 3; LLVM integrated assembler is wrong

In the .gcc_except_table section, the call site table uses similar label differences to define code ranges. For example:

$LFB0 = .
...
$LEHB0 = .
...
$LEHE0 = .
...
$L3:

        .uleb128 $LEHB0-$LFB0   // call site start, variable minus variable
        .uleb128 $LEHE0-$LEHB0  // call site end, variable minus variable
        .uleb128 $L3-$LFB0      // landing pad offset, label minus variable

These differences ensure exception handling, as documented in the GCC fix for MIPS16 EH issues ([committed] Fix a lot of MIPS16 EH failures).

In LLVM, MCAsmInfo::UseAssignmentForEHBegin is introduced to declare the function begin symbol as $func_begin0 = . instead of $func_begin0:.

@s-barannikov
Copy link
Contributor Author

FWIW on my downstream target I overload MCStreamer::emitLabel() for debug labels (introduce MCStreamer::emitDebugLabel()).
The reason is that on my target code labels must be 64-bit aligned (control transfer instructions require the destination to be aligned on that boundary). I need a separate method for debug labels because they must not be aligned, and it is impossible to differentiate them from code labels in emitLabel(). Debug labels must not be aligned because they may appear in a delay slot of a control transfer instruction, and aligning them will push a delayed instruction out of the delay slot.
I wonder if this approach could be useful for MIPS16.

var-const pushed a commit to ldionne/llvm-project that referenced this pull request Apr 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants