Skip to content

Commit 9d031c4

Browse files
committed
Mechanically port bulk of x86 builtins to TableGen
The goal is to make incremental (if small) progress towards fully TableGen'ed builtins, and to unblock llvm#120534 by gaining access to more powerful TableGen-based representations. The bulk `.td` file addition was generated with the help of a very rough Python script. That script made no attempt to be robust or reusable, it specifically handled only the cases in the X86 `.def` file. Four entries from the `.def` file were not handled automatically as they used `BUILTIN` rather than `TARGET_BUILTIN`. These were ported by hand to an empty-feature `TargetBuiltin` entry, which seems like a better match. For all the automatically ported entries, the results were compared by sorting and diffing the `.def` file and the generated `.inc` file. The only differences were: - Different horizontal whitespace - Additional entries that had already been ported to the `.td` file. - Systematically using `Oi` instead of `LLi` for the type `long long int`. The `.def` file uses a mixture of `Oi` and `LLi`. I chose the shorter encoding. This gives me high confidence in the correctness of the change.
1 parent 665d79f commit 9d031c4

File tree

6 files changed

+5419
-2238
lines changed

6 files changed

+5419
-2238
lines changed

clang/include/clang/Basic/BuiltinsBase.td

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,6 @@ class CustomEntry {
9595
}
9696

9797
class AtomicBuiltin : Builtin;
98-
class TargetBuiltin : Builtin {
99-
string Features = "";
100-
}
10198

10299
class LibBuiltin<string header, string languages = "ALL_LANGUAGES"> : Builtin {
103100
string Header = header;
@@ -122,6 +119,14 @@ class OCL_DSELangBuiltin : LangBuiltin<"OCL_DSE">;
122119
class OCL_GASLangBuiltin : LangBuiltin<"OCL_GAS">;
123120
class OCLLangBuiltin : LangBuiltin<"ALL_OCL_LANGUAGES">;
124121

122+
class TargetBuiltin : Builtin {
123+
string Features = "";
124+
}
125+
class TargetLibBuiltin : TargetBuiltin {
126+
string Header;
127+
string Languages = "ALL_LANGUAGES";
128+
}
129+
125130
class Template<list<string> substitutions,
126131
list<string> affixes,
127132
bit as_prefix = 0> {

0 commit comments

Comments
 (0)