This is an archive of the discontinued LLVM Phabricator instance.

[ARM] - Add the option to directly access TLS pointer
ClosedPublic

Authored by spetrovic on Jun 20 2017, 9:31 AM.

Details

Summary

This patch enables choice for accessing thread local storage pointer (like '-mtp' in gcc).
The values are:
'-mtp=soft': generate call to __aeabi_read_tp() - before this patch this was the only way to access the pointer, and it remains default.
'-mtp=cp15': read the pointer directly from coprocessor cp15, with 'mrc' instruction.

Diff Detail

Repository
rL LLVM

Event Timeline

spetrovic created this revision.Jun 20 2017, 9:31 AM

I think this fits in better as a subtarget feature controlled by "-mattr". The implementation could then be almost all in TableGen, just using different patterns for ARMthread_pointer (giving greater symmetry with the existing path). It would also make it much neater to pipe through to clang.

test/CodeGen/ARM/readtp.ll
22 ↗(On Diff #103223)

Isn't the actual register a pretty critical ABI issue?

spetrovic updated this revision to Diff 104388.Jun 28 2017, 5:49 AM
spetrovic marked an inline comment as done.

Comments addressed. I'm also preparing new patch for clang.

t.p.northover accepted this revision.Jun 28 2017, 9:45 AM

Thanks Strahinja, this looks good to me.

This revision is now accepted and ready to land.Jun 28 2017, 9:45 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptOct 27 2021, 10:33 AM