This is an archive of the discontinued LLVM Phabricator instance.

AArch64: Add support for reading pc using llvm.read_register.
ClosedPublic

Authored by pcc on Jun 17 2019, 8:38 PM.

Details

Summary

This is useful for allowing code to efficiently take an address
that can be later mapped onto debug info. Currently the hwasan
pass achieves this by taking the address of the current function:
http://llvm-cs.pcc.me.uk/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp#921

but this costs two instructions (plus a GOT entry in PIC code) per function
with stack variables. This will allow the cost to be reduced to a single
instruction.

Event Timeline

pcc created this revision.Jun 17 2019, 8:38 PM
pcc updated this revision to Diff 206111.Jun 21 2019, 6:53 PM
  • Instead of defining a pseudo-instruction, simply use the immediate form of the ADR instruction
eugenis accepted this revision.Jun 21 2019, 7:18 PM

LGTM

This revision is now accepted and ready to land.Jun 21 2019, 7:18 PM
This revision was automatically updated to reflect the committed changes.