Skip to content

Commit 4f1ef37

Browse files
committed
Bulk port 64-bit x86 builtins to TableGen
This PR follows llvm#120831 (the PR contains both, only review the last commit here as the other commit will be reviewed on the other PR). Similar to that PR, this does a very mechanical port of X86 builtins to TableGen. There is a *lot* of improvement available here to use TableGen more effectively and collapse repeated structures. But those can now be follow-up PRs that restructure *within* the `.td` file. The current structure produces a file that exactly matches the original X-macros except for the differences outlined in llvm#120831: - Horizontal whitespace - `long long` types now use `long long` outside of OpenCL, but switch to `long` in OpenCL (if relevant at all). Otherwise, only the order of builtins change, and no tests regress.
1 parent c15684d commit 4f1ef37

File tree

6 files changed

+520
-18
lines changed

6 files changed

+520
-18
lines changed

clang/include/clang/Basic/BuiltinsX86.td

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,7 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13-
include "clang/Basic/BuiltinsBase.td"
14-
15-
class X86Builtin<string prototype> : TargetBuiltin {
16-
let Spellings = ["__builtin_ia32_" # NAME];
17-
let Prototype = prototype;
18-
}
19-
20-
class X86NoPrefixBuiltin<string prototype> : TargetBuiltin {
21-
let Spellings = [NAME];
22-
let Prototype = prototype;
23-
}
24-
25-
class X86LibBuiltin<string prototype> : TargetLibBuiltin {
26-
let Spellings = [NAME];
27-
let Prototype = prototype;
28-
}
13+
include "clang/Basic/BuiltinsX86Base.td"
2914

3015
def rdpmc : X86Builtin<"unsigned long long int(int)">;
3116
def rdtsc : X86Builtin<"unsigned long long int()">;
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
//===--- BuiltinsX86Base.td - X86 Builtin function classes ------*- C++ -*-===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
//
9+
// This file defines the X86-specific builtin function classes.
10+
//
11+
//===----------------------------------------------------------------------===//
12+
13+
include "clang/Basic/BuiltinsBase.td"
14+
15+
class X86Builtin<string prototype> : TargetBuiltin {
16+
let Spellings = ["__builtin_ia32_" # NAME];
17+
let Prototype = prototype;
18+
}
19+
20+
class X86NoPrefixBuiltin<string prototype> : TargetBuiltin {
21+
let Spellings = [NAME];
22+
let Prototype = prototype;
23+
}
24+
25+
class X86LibBuiltin<string prototype> : TargetLibBuiltin {
26+
let Spellings = [NAME];
27+
let Prototype = prototype;
28+
}

0 commit comments

Comments
 (0)