Page MenuHomePhabricator

ARM: Fix TPsoft for Thumb mode
ClosedPublic

Authored by cpirker on Jun 20 2014, 8:51 AM.

Details

Reviewers
cpirker
Summary

Hi all,

The use of thread local storage (TLS) requires the thread pointer to access thread specific data.
LLVM generates subroutine calls to a ABI specified function "__eabi_read_tp" to get hold of the thread pointer.
Unfortunately, LLVM uses the ARM coding of the branch long instructions in Thumb mode, instead of the Thumb encoding.
This patch enables the correct encoding for the Thumb branch long instruction.

Please review, thanks,
Christian

Diff Detail

Event Timeline

cpirker updated this revision to Diff 10695.Jun 20 2014, 8:51 AM
cpirker retitled this revision from to ARM: Fix TPsoft for Thumb mode.
cpirker updated this object.
cpirker edited the test plan for this revision. (Show Details)
cpirker added subscribers: Unknown Object (MLST), Konrad.
mroth added a subscriber: mroth.Jun 20 2014, 9:08 AM
rengolin added inline comments.
lib/Target/ARM/ARMExpandPseudoInsts.cpp
934

Is this to cope with IT blocks?

lib/Target/ARM/ARMInstrInfo.td
5118

Is this really necessary? I'd have thought that everything in here is ARM anyway, plus the instruction is different (tTPsoft instead of TPsoft).

cpirker added inline comments.Jun 24 2014, 7:59 AM
lib/Target/ARM/ARMExpandPseudoInsts.cpp
934

Yes, ARMCC::AL marks an unconditional branch.

lib/Target/ARM/ARMInstrInfo.td
5118

This pattern matches both in ARM and Thumb mode.
This predicate makes LLVM to match the tTPsoft pattern in Thumb mode.
I can change "PseudoInst" to "ARMPseudoInst" so that the predicate can be omitted, what you think?

With the ARMPseudoInst change, LGTM.

Thanks!
--renato

lib/Target/ARM/ARMInstrInfo.td
5118

I can change "PseudoInst" to "ARMPseudoInst" so that the predicate can be omitted, what you think?

I think it's better, since the Thumb version use tPseudoInst.

cpirker accepted this revision.EditedJun 24 2014, 8:57 AM
cpirker added a reviewer: cpirker.

Hi Renato,

I updated the patch and committed as rL211601.

Thanks,
Christian

This revision is now accepted and ready to land.Jun 24 2014, 8:57 AM
cpirker closed this revision.Jun 24 2014, 8:59 AM