This is an archive of the discontinued LLVM Phabricator instance.

Refine the condition for when to use CALL16 vs a GOT displacement.
ClosedPublic

Authored by bsdjhb on Jun 7 2017, 9:58 AM.

Details

Summary

Borrow from the logic for 'jal' in MipsAsmParser::processInstruction
and add the extra condition of bypassing CALL16 if the destination symbol
is an ELF symbol with STB_LOCAL binding.

Diff Detail

Repository
rL LLVM

Event Timeline

bsdjhb created this revision.Jun 7 2017, 9:58 AM

Splitting this out from D33948. However, I'm also interested in the patch you mentioned in the other review for fixing forward-declared local symbols. It may be that fixing that resolves the use case that prompted this patch, so I'm not sure if checking STB_LOCAL will still be required.

sdardis accepted this revision.Jun 26 2017, 7:09 AM

LGTM apart from formatting. Do you need me to commit this for you?

lib/Target/Mips/AsmParser/MipsAsmParser.cpp
2868–2872 ↗(On Diff #101761)

This hunk is not clang-formatted. It should be:

if ((DstReg == Mips::T9 || DstReg == Mips::T9_64) && !UseSrcReg &&                                                 
    Res.getConstant() == 0 &&
    !(Res.getSymA()->getSymbol().isInSection() ||                                                                  
      Res.getSymA()->getSymbol().isTemporary() ||                                                                  
      (Res.getSymA()->getSymbol().isELF() &&
       cast<MCSymbolELF>(Res.getSymA()->getSymbol()).getBinding() ==                                               
           ELF::STB_LOCAL))) {
This revision is now accepted and ready to land.Jun 26 2017, 7:09 AM

Please commit for me as I don't have that ability currently. I'll be sure to run clang-format over my other mips64 dla PIC change and update it as well.

This revision was automatically updated to reflect the committed changes.