This is an archive of the discontinued LLVM Phabricator instance.

Create llvm.addressofreturnaddress intrinsic
ClosedPublic

Authored by agutowski on Oct 5 2016, 4:12 PM.

Details

Summary

We need a new LLVM intrinsic to implement MS _AddressOfReturnAddress builtin on 64-bit Windows.

Event Timeline

agutowski updated this revision to Diff 73703.Oct 5 2016, 4:12 PM
agutowski retitled this revision from to Create llvm.addressofreturnaddress intrinsic.
agutowski updated this object.
agutowski added reviewers: rnk, majnemer.
agutowski added a subscriber: llvm-commits.
majnemer edited edge metadata.Oct 5 2016, 4:17 PM

Cool :)

test/CodeGen/X86/addr-of-ret-addr.ll
1–2

Might be better to use FileCheck.

test/CodeGen/X86/win64_frame.ll
187

What happens if the frame pointer is eliminated? The return address should just be at %([re]sp) no?

agutowski updated this revision to Diff 73709.Oct 5 2016, 4:26 PM
agutowski edited edge metadata.

use FileCheck instead of grep; add a test without frame pointer

agutowski updated this revision to Diff 73712.Oct 5 2016, 4:51 PM

fix previous change with FileCheck

agutowski marked an inline comment as done.Oct 11 2016, 10:58 AM
agutowski added inline comments.
test/CodeGen/X86/win64_frame.ll
187

Yes, added test for that too.

rnk added inline comments.Oct 11 2016, 2:43 PM
docs/LangRef.rst
9317

I would just state this as a complete sentence:

This intrinsic is only implemented for x86.
lib/CodeGen/IntrinsicLowering.cpp
446

is that what clang-format does?

test/CodeGen/X86/addr-of-ret-addr.ll
9

Use CHECK-LABEL, and check for the pushl and pushq for x86 and x64 respectively. That's where we get the 4 and 8 offsets from.

test/CodeGen/X86/win64_frame.ll
187

Can you check for pushq and CHECK-NOT for push in f12?

agutowski updated this revision to Diff 74307.Oct 11 2016, 4:03 PM

check for "push" in tests; fix formatting; change wording in documentation

agutowski added inline comments.Oct 11 2016, 4:08 PM
lib/CodeGen/IntrinsicLowering.cpp
446

No, that was how it was formatted above, in return/frame address. I applied clang-format in both places now.

agutowski updated this revision to Diff 74309.Oct 11 2016, 4:09 PM

change tabs to spaces

agutowski marked an inline comment as done.Oct 12 2016, 3:16 PM
rnk accepted this revision.Oct 12 2016, 3:19 PM
rnk edited edge metadata.

lgtm

This revision is now accepted and ready to land.Oct 12 2016, 3:19 PM
agutowski closed this revision.Oct 12 2016, 3:22 PM