Page MenuHomePhabricator

[mips] Emit .reloc R_{MICRO}MIPS_JALR along with j(al)r(c) $25
ClosedPublic

Authored by vstefanovic on Jan 14 2019, 6:04 PM.

Details

Summary

The callee address is added as an optional operand (MCSymbol) in
AdjustInstrPostInstrSelection() and then used by asm printer to insert:
'.reloc tmplabel, R_MIPS_JALR, symbol
tmplabel:'.
Controlled with '-mips-jalr-reloc', default is true.

Diff Detail

Repository
rL LLVM

Event Timeline

vstefanovic created this revision.Jan 14 2019, 6:04 PM
atanasyan added inline comments.Jan 16 2019, 8:10 AM
lib/Target/Mips/MipsAsmPrinter.cpp
165
  1. Let's move this if statement where we call emitDirectiveRelocJalr. So we will not call emitDirectiveRelocJalr for move, compare etc instructions at all.
  2. If I comment out this statement no one test fail. I think we need a test checks that we do not emit JALR for inappropriate instructions.

Moved an if, fixed typos.

vstefanovic marked an inline comment as done.Jan 17 2019, 7:58 AM
vstefanovic added inline comments.
lib/Target/Mips/MipsAsmPrinter.cpp
165

This 'if' is not to prevent emitting any wrong .reloc but only to skip looping over instructions that certainly don't have an MO_JALR operand.
Btw, this function is inlined for non-O0.

Fixed 'typos'.

This revision is now accepted and ready to land.Jan 17 2019, 12:53 PM
This revision was automatically updated to reflect the committed changes.