This is an archive of the discontinued LLVM Phabricator instance.

[Clang][LoongArch] Implement patchable function entry
ClosedPublic

Authored by xen0n on Jan 15 2023, 2:25 AM.

Details

Summary

Similar to D98610 for RISCV.

This is going to be required by the upcoming Linux/LoongArch
support for dynamic ftrace.

Diff Detail

Event Timeline

xen0n created this revision.Jan 15 2023, 2:25 AM
xen0n requested review of this revision.Jan 15 2023, 2:25 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJan 15 2023, 2:25 AM
xen0n edited the summary of this revision. (Show Details)Jan 15 2023, 2:26 AM

Does anyone know why patchable-function-entry is not documented in https://llvm.org/docs/LangRef.html#function-attributes?

llvm/lib/Target/LoongArch/LoongArchMCInstLower.cpp
150 ↗(On Diff #489337)

Seems should return true? Consider when verifier is disabled.

How about handling PATCHABLE_FUNCTION_ENTER in LoongArchAsmPrinter.cpp like D140727?

The Clang bits LGTM, though you should add a release note about the new functionality so users know about it.

xen0n added inline comments.Feb 6 2023, 10:50 PM
llvm/lib/Target/LoongArch/LoongArchMCInstLower.cpp
150 ↗(On Diff #489337)

I've checked other targets and indeed implementation in AsmPrinter is the more widespread approach (RISCV is the outlier here). Let me adjust in one or two days.

xen0n updated this revision to Diff 497596.Feb 15 2023, 2:08 AM

Rebase and change to lower the op in LoongArchAsmPrinter so as to make people's lives easier when they come to rebase D141785 on top of this.

xen0n updated this revision to Diff 497598.Feb 15 2023, 2:16 AM

Document the change in Clang release note.

SixWeining accepted this revision.Feb 15 2023, 5:44 PM

LGTM. Thanks.

This revision is now accepted and ready to land.Feb 15 2023, 5:44 PM
MaskRay accepted this revision.Feb 15 2023, 5:47 PM