Commit Graph

1070 Commits

Author SHA1 Message Date
Nikolas Klauser
508263824f [Clang] Start moving X86Builtins.def to X86Builtins.td (#106005)
This starts moving `X86Builtins.def` to be a tablegen file. It's quite
large, so I think it'd be good to move things in multiple steps to avoid
a bunch of merge conflicts due to the amount of time this takes to
complete.
2024-10-30 14:23:35 +01:00
Rahul Joshi
8e6856e278 [Clang][TableGen] Use StringRef::str() instead of std::string() cast (#113645)
Use `StringRef::str()` instead of std::string(StringRef) to cast from
StringRef to std::string.
2024-10-28 16:15:39 -07:00
Rahul Joshi
e0a02fdb45 [NFC][Clang][TableGen] Use StringRef in FlattenedSpelling (#113809)
- Change FlattenedSpelling to use StringRef instead of std::String.
- Use range for loops and enumerate().
- Use ArrayRef<> instead of std::vector reference as function arguments.
- Use {} for all if/else branch bodies if one of them uses it.
2024-10-28 11:43:28 -07:00
Momchil Velikov
1df5c94343 [AArch64] Implement FP8 floating-point mode helper intrinsics (#100608)
Implement FP8 mode helper intrinsics (as inline functions) as
specified in ACLE 2024Q3 "14.2 Helper intrinsics"

https://github.com/ARM-software/acle/releases/download/r2024Q3/acle-2024Q3.pdf
2024-10-28 11:22:38 +00:00
CarolineConcatto
49940514e2 [CLANG][AArch64] Add the modal 8 bit floating-point scalar type (#97277)
ARM ACLE PR#323[1] adds new modal types for 8-bit floating point
intrinsic.

From the PR#323:
```
ACLE defines the `__mfp8` type, which can be used for the E5M2 and E4M3
8-bit floating-point formats. It is a storage and interchange only type
with no arithmetic operations other than intrinsic calls.
````

The type should be an opaque type and its format in undefined in Clang.
Only defined in the backend by a status/format register, for AArch64 the
FPMR.

This patch is an attempt to the add the mfloat8_t scalar type. It has a
parser and codegen for the new scalar type.

The patch it is lowering to and 8bit unsigned as it has no format. But
maybe we should add another opaque type.

[1]  https://github.com/ARM-software/acle/pull/323
2024-10-25 13:59:46 +01:00
Jay Foad
4dd55c567a [clang] Use {} instead of std::nullopt to initialize empty ArrayRef (#109399)
Follow up to #109133.
2024-10-24 10:23:40 +01:00
CarolineConcatto
6dad29aebc [CLANG][AArch64]Add Neon vectors for mfloat8_t (#99865)
This patch adds these new vector sizes for neon:
   mfloat8x16_t and mfloat8x8_t

    According to the ARM ACLE PR#323[1].

    [1] ARM-software/acle#323
2024-10-23 13:23:18 +01:00
Jay Foad
922992a22f Fix typo "instrinsic" (#112899) 2024-10-18 15:58:33 +01:00
Rahul Joshi
62e2c7fb2d [LLVM][TableGen] Change all Init pointers to const (#112705)
This is a part of effort to have better const correctness in TableGen
backends:


https://discourse.llvm.org/t/psa-planned-changes-to-tablegen-getallderiveddefinitions-api-potential-downstream-breakages/81089
2024-10-18 07:50:22 -07:00
CarolineConcatto
508fd966fb [CLANG][AArch64]Add SVE tuple types for mfloat8_t (#112687)
This patch adds scalable tuple types vectors for MFloat_8 type,
according to the ACLE[1].

[1] https://github.com/ARM-software/acle.git
2024-10-18 09:10:17 +01:00
CarolineConcatto
cb43021e57 [CLANG]Add Scalable vectors for mfloat8_t (#101644)
This patch adds these new vector sizes for sve:
    svmfloat8_t

According to the ARM ACLE PR#323[1].

[1] ARM-software/acle#323
2024-10-17 09:22:55 +01:00
Rahul Joshi
cba7b369b2 [Clang][TableGen] Use const pointers for various Init objects in MveEmitter (#112320)
Use const pointers for various Init objects in MveEmitter. This is a
part of effort to have better const correctness in TableGen backends:


https://discourse.llvm.org/t/psa-planned-changes-to-tablegen-getallderiveddefinitions-api-potential-downstream-breakages/81089
2024-10-16 07:20:18 -07:00
Rahul Joshi
ffc5b191c8 [Clang][TableGen] Use const pointers for various Init objects in Diagnostic Emitter (#112318)
Use const pointers for various Init objects in Diagnostic Emitter. This
is a part of effort to have better const correctness in TableGen
backends:


https://discourse.llvm.org/t/psa-planned-changes-to-tablegen-getallderiveddefinitions-api-potential-downstream-breakages/81089
2024-10-15 15:49:23 -07:00
Rahul Joshi
9b422d14f3 [Clang][TableGen] Use const pointers for various Init objects in NeonEmitter (#112317)
Use const pointers for various Init objects in NeonEmitter. This is a
part of effort to have better const correctness in TableGen backends:

https://discourse.llvm.org/t/psa-planned-changes-to-tablegen-getallderiveddefinitions-api-potential-downstream-breakages/81089
2024-10-15 15:48:42 -07:00
Rahul Joshi
d1a47915d0 [Clang][TableGen] Use const pointers for various Init * pointers in SA checker emitter (#112321)
Use const pointers for various Init objects in SA checker emitter. This
is a part of effort to have better const correctness in TableGen
backends:


https://discourse.llvm.org/t/psa-planned-changes-to-tablegen-getallderiveddefinitions-api-potential-downstream-breakages/81089
2024-10-15 12:50:44 -07:00
Brandon Wu
46f953d1d9 [clang][RISCV] Correct the SEW operand of indexed/fault only first segment intrinsics (#111476)
Indexed segment load/store intrinsics don't have SEW information encoded
in the name, so we need to get the information from its pointer type
argument at runtime.
2024-10-15 07:40:37 -07:00
Eric Astor
73e74e496e [clang][frontend] Support applying the annotate attribute to statements (#111841)
By allowing AnnotateAttr to be applied to statements, users can place arbitrary information in the AST for later use.

For example, this can be used for HW-targeted language extensions that involve specialized loop annotations.
2024-10-10 12:21:34 -04:00
Sander de Smalen
f22e6d5919 [Clang][AArch64] Fix checkArmStreamingBuiltin for 'sve-b16b16' (#109420)
The implementation made the assumption that any feature starting with
"sve" meant that this was an SVE feature. This is not the case for
"sve-b16b16", as this is a feature that applies to both SVE and SME.

This meant that:
```
  __attribute__((target("+sme2,+sve2,+sve-b16b16")))
  svbfloat16_t foo(svbfloat16_t a, svbfloat16_t b, svbfloat16_t c)
                                                      __arm_streaming {
      return svclamp_bf16(a, b, c);
  }
```
would result in an incorrect diagnostic saying that `svclamp_bf16` could
only be used in non-streaming functions.
2024-10-08 10:01:40 +01:00
Kazu Hirata
6a8fcb0fa8 [TableGen] Avoid repeated hash lookups (NFC) (#111089) 2024-10-04 07:37:31 -07:00
Rahul Joshi
65e69f7436 [NFC][TableGen] Change Record::getSuperClasses to use const Record* (#110845)
Change `Record::getSuperClasses` to return a const pointer to the
superclass records.

This is a part of effort to have better const correctness in TableGen
backends:


https://discourse.llvm.org/t/psa-planned-changes-to-tablegen-getallderiveddefinitions-api-potential-downstream-breakages/81089
2024-10-02 13:24:46 -07:00
Rahul Joshi
d256b9e88b [TableGen] Change DefInit::Def to a const Record pointer (#110747)
This change undoes a const_cast<> introduced in an earlier change to
help transition to const pointers. It is a part of effort to have better
const correctness in TableGen backends:


https://discourse.llvm.org/t/psa-planned-changes-to-tablegen-getallderiveddefinitions-api-potential-downstream-breakages/81089
2024-10-02 09:48:26 -07:00
Rahul Joshi
a140931be5 [TableGen] Change getValueAsListOfDefs to return const pointer vector (#110713)
Change `getValueAsListOfDefs` to return a vector of const Record
pointer, and remove `getValueAsListOfConstDefs` that was added as a
transition aid.

This is a part of effort to have better const correctness in TableGen
backends:


https://discourse.llvm.org/t/psa-planned-changes-to-tablegen-getallderiveddefinitions-api-potential-downstream-breakages/81089
2024-10-01 14:30:38 -07:00
Rahul Joshi
e9dbdb20f2 [Clang][TableGen] Change NeonEmitter to use const Record * (#110597)
This is a part of effort to have better const correctness in TableGen
backends:


https://discourse.llvm.org/t/psa-planned-changes-to-tablegen-getallderiveddefinitions-api-potential-downstream-breakages/81089
2024-10-01 10:47:09 -07:00
Rahul Joshi
1d39b4f717 [Clang][TableGen] Change SACheckersEmitter to use const Record * (#110596)
This is a part of effort to have better const correctness in TableGen
backends:


https://discourse.llvm.org/t/psa-planned-changes-to-tablegen-getallderiveddefinitions-api-potential-downstream-breakages/81089
2024-10-01 10:46:32 -07:00
Rahul Joshi
cea09886c2 [Clang][TableGen] Change OptionDoc Emitter to use const Record * (#110592)
This is a part of effort to have better const correctness in TableGen
backends:


https://discourse.llvm.org/t/psa-planned-changes-to-tablegen-getallderiveddefinitions-api-potential-downstream-breakages/81089
2024-10-01 10:45:57 -07:00
Rahul Joshi
fdfd326a01 [Clang][LLVM] Change OpenCL Emitter to use const Record * (#110590)
This is a part of effort to have better const correctness in TableGen
backends:


https://discourse.llvm.org/t/psa-planned-changes-to-tablegen-getallderiveddefinitions-api-potential-downstream-breakages/81089
2024-10-01 06:53:13 -07:00
Rahul Joshi
5831eed8d0 [Clang][TableGen] Change Opcodes Emitter to use const Record * (#110588)
This is a part of effort to have better const correctness in TableGen
backends:


https://discourse.llvm.org/t/psa-planned-changes-to-tablegen-getallderiveddefinitions-api-potential-downstream-breakages/81089
2024-10-01 06:52:48 -07:00
Rahul Joshi
52e7c699a5 [Clang][TableGen] Change ClangDiagnosticEmitter to use const Record * (#110585)
This is a part of effort to have better const correctness in TableGen
backends:


https://discourse.llvm.org/t/psa-planned-changes-to-tablegen-getallderiveddefinitions-api-potential-downstream-breakages/81089
2024-10-01 06:52:20 -07:00
Rahul Joshi
017c2aba61 [Clang][TableGen] Change ClangAttrEmitter to use const Record * (#110584)
This is a part of effort to have better const correctness in TableGen
backends:


https://discourse.llvm.org/t/psa-planned-changes-to-tablegen-getallderiveddefinitions-api-potential-downstream-breakages/81089
2024-10-01 06:51:49 -07:00
Rahul Joshi
a86e966a20 [TableGen] Change TableGenMain to use const RecordKeeper (#110578)
Change TableGenMain's `MainFn` argument to be a function that accepts a
const reference to RecordKeeper.

This is a part of effort to have better const correctness in TableGen
backends:


https://discourse.llvm.org/t/psa-planned-changes-to-tablegen-getallderiveddefinitions-api-potential-downstream-breakages/81089
2024-10-01 06:51:07 -07:00
Rahul Joshi
7ac474baad [LLVM][TableGen] Change SeachableTableEmitter to use const RecordKeeper (#110032)
Change SeachableTableEmitter to use const RecordKeeper.
Also change RecordRecTy to use const Record pointers for its classes.

This is a part of effort to have better const correctness in TableGen
backends:


https://discourse.llvm.org/t/psa-planned-changes-to-tablegen-getallderiveddefinitions-api-potential-downstream-breakages/81089
2024-09-30 10:08:48 -07:00
Kazu Hirata
68849a8788 [TableGen] Use StringSet instead of StringMap (NFC) (#109469) 2024-09-20 20:32:23 -07:00
Kazu Hirata
d64fc57353 [TableGen] Use StringSet instead of StringMap (NFC) (#109441) 2024-09-20 13:15:08 -07:00
Kazu Hirata
5b7b52f9e9 [TableGen] Avoid repeated hash lookups (NFC) (#109372) 2024-09-20 09:03:25 -07:00
Rahul Joshi
adb7004514 [LLVM][CLange] Rename NodeType::Record to NodeType::Rec (#108826)
Fixes build failure by avoiding conflicting with `Record` class name.
2024-09-16 06:59:36 -07:00
Rahul Joshi
0e948bfd31 [NFC][clang][TableGen] Remove redundant llvm:: namespace qualifier (#108627)
Remove llvm:: from .cpp files, and add "using namespace llvm" if needed.
2024-09-16 06:35:34 -07:00
Rahul Joshi
a06d84abd3 [NFC][Clang][TableGen] Refactor ClangASTNodesEmitter (#108580)
Change macroName() to accept a StringRef to avoid extra string copy. 
Simplify ASTNode comparison function.
Use equal_range() instead of calling lower_bound() and upper_bound()
separately for std::multimap.
No need to use std::make_pair.
2024-09-16 06:34:56 -07:00
Kazu Hirata
56f061f71b [TableGen] Avoid repeated hash lookups (NFC) (#108736) 2024-09-15 01:20:37 -07:00
Kazu Hirata
bae275f65e [TableGen] Avoid repeated map lookups (NFC) (#108675) 2024-09-14 07:39:00 -07:00
JOE1994
918972bded [clang] Strip unneeded calls to raw_string_ostream::str() (NFC)
Avoid extra layer of indirection.

p.s.
Also, remove calls to raw_string_ostream::flush(), which are no-ops.
2024-09-14 04:38:50 -04:00
Rahul Joshi
711278e273 [clang][TableGen] Change SVE Emitter to use const RecordKeeper (#108503)
Change SVE Emitter to use const RecordKeeper.

This is a part of effort to have better const correctness in TableGen
backends:


https://discourse.llvm.org/t/psa-planned-changes-to-tablegen-getallderiveddefinitions-api-potential-downstream-breakages/81089
2024-09-13 07:53:30 -07:00
Rahul Joshi
974fa8522b [clang][TableGen] Change RISCVVEmitter to use const RecordKeeper (#108502)
Change RISCVVEmitter to use const RecordKeeper.

This is a part of effort to have better const correctness in TableGen
backends:


https://discourse.llvm.org/t/psa-planned-changes-to-tablegen-getallderiveddefinitions-api-potential-downstream-breakages/81089
2024-09-13 07:53:01 -07:00
Rahul Joshi
a4b1617368 [clang][TableGen] Change NeonEmitter to use const RecordKeeper (#108501)
Change NeonEmitter to use const RecordKeeper.

This is a part of effort to have better const correctness in TableGen
backends:


https://discourse.llvm.org/t/psa-planned-changes-to-tablegen-getallderiveddefinitions-api-potential-downstream-breakages/81089
2024-09-13 07:52:37 -07:00
Rahul Joshi
75d8724787 [clang][TableGen] Change MVE Emitter to use const RecordKeeper (#108500)
Change MVE Emitter to use const RecordKeeper.

This is a part of effort to have better const correctness in TableGen
backends:


https://discourse.llvm.org/t/psa-planned-changes-to-tablegen-getallderiveddefinitions-api-potential-downstream-breakages/81089
2024-09-13 07:52:14 -07:00
Rahul Joshi
d757bbf68f [clang][TableGen] Change SyntaxEmitter to use const RecordKeeper (#108478)
Change SyntaxEmitter to use const RecordKeeper.

This is a part of effort to have better const correctness in TableGen
backends:


https://discourse.llvm.org/t/psa-planned-changes-to-tablegen-getallderiveddefinitions-api-potential-downstream-breakages/81089
2024-09-13 07:51:42 -07:00
Rahul Joshi
f637273d77 [clang][TableGen] Change SACheckersEmitter to use const RecordKeeper (#108477)
Change SACheckersEmitter to use const RecordKeeper.

This is a part of effort to have better const correctness in TableGen
backends:


https://discourse.llvm.org/t/psa-planned-changes-to-tablegen-getallderiveddefinitions-api-potential-downstream-breakages/81089
2024-09-13 07:51:17 -07:00
Rahul Joshi
387ef59ab9 [clang][TableGen] Change TypeNodesEmitter to use const RecordKeeper (#108476)
Change TypeNodesEmitter to use const RecordKeeper.

This is a part of effort to have better const correctness in TableGen
backends:


https://discourse.llvm.org/t/psa-planned-changes-to-tablegen-getallderiveddefinitions-api-potential-downstream-breakages/81089
2024-09-13 07:50:45 -07:00
Rahul Joshi
3c9db3a627 [clang][TableGen] Change ASTProperties Emitter to use const RecordKeeper (#108274)
Change ASTProperties Emitter to use const RecordKeeper.

This is a part of effort to have better const correctness in TableGen
backends:


https://discourse.llvm.org/t/psa-planned-changes-to-tablegen-getallderiveddefinitions-api-potential-downstream-breakages/81089
2024-09-12 18:37:41 -07:00
Rahul Joshi
b6ff8ed5d4 [clang][TableGen] Change AST Nodes Emitter to use const RecordKeeper (#108270)
Change AST Nodes Emitter to use const RecordKeeper.

This is a part of effort to have better const correctness in TableGen
backends:


https://discourse.llvm.org/t/psa-planned-changes-to-tablegen-getallderiveddefinitions-api-potential-downstream-breakages/81089
2024-09-12 06:51:51 -07:00
Rahul Joshi
dbc90b55e8 [clang][TableGen] Change AttrEmitter to use const RecordKeeper (#108269)
Change AttrEmitter to use const RecordKeeper.

This is a part of effort to have better const correctness in TableGen
backends:


https://discourse.llvm.org/t/psa-planned-changes-to-tablegen-getallderiveddefinitions-api-potential-downstream-breakages/81089
2024-09-12 06:51:25 -07:00