There are some users want to use __SSC_MARK for special use.
But They don't want to use #include xxx in they program.
So Support SSC_MARK(const int) as X86 builtin function.
Differential D108439
[X86] Support __SSC_MARK(const int) xiangzhangllvm on Aug 19 2021, 7:28 PM. Authored by
Details
There are some users want to use __SSC_MARK for special use. So Support SSC_MARK(const int) as X86 builtin function.
Diff Detail Event TimelineComment Actions Hello, @erichkeane , the patch is small and clear, and due to it changes at FE, could you help review ? Thanks a lot!
Comment Actions There are some users want to use __SSC_MARK for special use. But They don't want to use #include xxx in they program. Aaron said: so another alternative I could live with would be to not add this builtin at all.) This is a great point, the justification of "some users dont' want to use #include doesn't seem motivating to me at all. I recognize that ICC automatically includes intrin headers, but the Clang project decided years ago to not follow that on that path and implement these things in the intrinsic headers. This is a change that doesn't belong in the frontend. I was mildly convinced as a builtin to support this (by an appropriate name), but the more I look at it, the more I realize that the code to generate the IR for this is so incredibly better done as an intrinsic entry. So in summary: I am thoroughly convinced to reject this as a frontend change unless there is a distinct technical reason (besides "users don't want to #include"). Comment Actions I'm not sure icc automatically includes intrinsic headers. I couldn't prove that on godbolt. It still required me to include xmmintrin.h or similar. The intrinsic functions aren't in the header, but maybe it detects that the file was included? The definition for the __m128i and similar types used by the intrinsics is in the header. __SSC_MARK is supported by icc without a header. I'm not sure where it is documented so I don't know if it has a defined header a user could include. Comment Actions Right, ICC has some funny-business going on with the intrinsic headers that are a little odd. We recognize/generate many of them without needing to do the #include, so it isn't really ACTUALLY automatically including the intrinsic headers, it is just automatically including a large subset of the intrinsics. Comment Actions 1st, I am not clear about "how ICC automatically including the intrinsic headers", But I did a try that first delete the intrinsic head file which def the SSC_MARK from ICC project, then I build SSC_MARK code with ICC, it still passed. I think if it "automatically including the intrinsic headers" it should be fail.
2nd, I begin to agree this point, I do same check for builtins in clang/Basic/Builtins.def with GCC (include libxxx in gcc source), that matches erich's point. Comment Actions implement with #include headfile at https://reviews.llvm.org/D108682 |
It seems using upper case letters discords current naming conversions. May be better to define __builtin_ssc_mark here and add Builder.defineMacro("__SSC_MARK", "__builtin_ssc_mark") in X86.cpp.