This is an archive of the discontinued LLVM Phabricator instance.

[cfe][inline-asm] Support target-specific escaped character in inline asm
ClosedPublic

Authored by myhsu on May 24 2021, 10:03 AM.

Details

Summary

GCC allows each target to define a set of non-letter and non-digit escaped characters for inline assembly that will be replaced by another string (They call this "punctuation" characters. The existing "%%" and "%{" -- replaced by '%' and '{' at the end -- can be seen as special cases shared by all targets).
This patch implements this feature by adding a new hook in TargetInfo.

Updated: In case you wonder, this is a list of supported punctuation chars for i386 in GCC.
And these are punctuations for M68k.

Diff Detail

Event Timeline

myhsu requested review of this revision.May 24 2021, 10:03 AM
myhsu created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptMay 24 2021, 10:03 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
myhsu edited the summary of this revision. (Show Details)May 24 2021, 10:10 AM
clang/include/clang/Basic/TargetInfo.h
1094–1095

Use triple slashes so that a Doxygen comment can be produced. End sentence with a period.

clang/lib/AST/Stmt.cpp
676

Terminate sentence with period.

676–680

Do you want to move this addition into the default case above?

nickdesaulniers accepted this revision.May 24 2021, 10:17 AM

LGTM; please fix up minor nits. Thanks for the patch!

This revision is now accepted and ready to land.May 24 2021, 10:17 AM
myhsu updated this revision to Diff 347574.May 24 2021, 9:27 PM
myhsu marked 3 inline comments as done.

Fix formatting

This revision was landed with ongoing or failed builds.May 24 2021, 9:40 PM
This revision was automatically updated to reflect the committed changes.