This is documented as the appropriate template modifier for call operands.
Fixes PR44272, and adds a regression test.
Also adds support for operand modifiers in Intel-style inline assembly.
Paths
| Differential D71677
[ms] [X86] Use "P" modifier on operands to call instructions in inline X86 assembly. ClosedPublic Authored by epastor on Dec 18 2019, 1:47 PM.
Details Summary This is documented as the appropriate template modifier for call operands. Also adds support for operand modifiers in Intel-style inline assembly.
Diff Detail
Event TimelineHerald added projects: Restricted Project, Restricted Project. · View Herald TranscriptDec 18 2019, 1:47 PM epastor retitled this revision from Summary:
Use "P" modifier on operands to call instructions in inline X86 assembly. to [ms] [X86] Use "P" modifier on operands to call instructions in inline X86 assembly..Dec 18 2019, 1:52 PM Comment Actions Unit tests: pass. 60853 tests passed, 0 failed and 726 were skipped. clang-tidy: fail. Please fix clang-tidy findings. clang-format: fail. Please format your changes with clang-format by running git-clang-format HEAD^ or applying this patch. Build artifacts: diff.json, clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml Comment Actions Where is {0:P} actually documented? I don't see it in LangRef, but I do see it in the code.
Comment Actions
https://llvm.org/docs/LangRef.html#asm-template-argument-modifiers, under X86; specifically documented to be used on the operands of call instructions.
Comment Actions lgtm
This revision is now accepted and ready to land.Dec 21 2019, 3:21 PM epastor marked an inline comment as done. Comment ActionsFix test; missing anchor meant the previous version would not catch a regression. Comment Actions Unit tests: pass. 61087 tests passed, 0 failed and 728 were skipped. clang-tidy: fail. Please fix clang-tidy findings. clang-format: fail. Please format your changes with clang-format by running git-clang-format HEAD^ or applying this patch. Build artifacts: diff.json, clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml Closed by commit rGdc5b614fa9a1: [ms] [X86] Use "P" modifier on operands to call instructions in inline X86… (authored by epastor). · Explain WhyDec 22 2019, 6:48 AM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 235049 clang/lib/CodeGen/TargetInfo.cpp
clang/test/CodeGen/mozilla-ms-inline-asm.c
clang/test/CodeGen/ms-inline-asm.c
clang/test/CodeGen/ms-inline-asm.cpp
llvm/include/llvm/MC/MCParser/MCParsedAsmOperand.h
llvm/include/llvm/MC/MCParser/MCTargetAsmParser.h
llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
llvm/lib/MC/MCParser/AsmParser.cpp
llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
llvm/lib/Target/X86/AsmParser/X86Operand.h
llvm/lib/Target/X86/X86AsmPrinter.h
llvm/lib/Target/X86/X86AsmPrinter.cpp
llvm/test/CodeGen/X86/ms-inline-asm-PR44272.ll
|
I'm trying to think of other edge cases where we'd want the same treatment. In theory, we'd want to do this for every control flow instruction that takes a PC-relative operand, jmp, jcc, jecxz, that might be all. You know, it actually seems reasonable to set up a naked function that contains an asm blob which conditionally branches to another function, so I guess we should support it. In that case, maybe this should be named something like "isBranchTarget" instead of isCallTarget.