Commit Graph

509 Commits

Author SHA1 Message Date
Simon Pilgrim d1b57086d5 DetailedRecordsBackend.cpp - printSectionHeading - avoid std::string creation/copies.
Don't create std::string from constant c-strings or pass std::string by value - we can use StringRef instead.
2021-06-13 16:49:40 +01:00
Simon Pilgrim a03d09f423 DetailedRecordsBackend.cpp - tidy implicit header dependencies. NFCI.
We don't use <algorithm>, <set> or <vector>, but we do use std::pair (<utility>).
2021-06-13 16:27:17 +01:00
Paul C. Anagnostopoulos 407c11b563 [TableGen] Eliminate dead code in ParseForeachDeclaration [NFC]
Differential Revision: https://reviews.llvm.org/D103904
2021-06-10 10:34:44 -04:00
Paul C. Anagnostopoulos ef8df920fb [TableGen] Fix ProfileFoldOpInit so that parameters are named consistently [NFC]
See https://bugs.llvm.org/show_bug.cgi?id=50595

Differential Revision: https://reviews.llvm.org/D103823
2021-06-09 09:23:31 -04:00
Paul C. Anagnostopoulos fe9101c3d8 [TableGen] Make the NUL character invalid in .td files
Now uses tr instead of sed.

Differential Revision: https://reviews.llvm.org/D102254
2021-05-13 10:17:45 -04:00
Paul C. Anagnostopoulos 46402eb103 Revert "[TableGen] Make the NUL character invalid in .td files"
At least one build uses a 'sed' that does not understand \x00.

This reverts commit cf9647011c4f05e1eb4423c6637d84e2f26b2042.
2021-05-11 10:43:13 -04:00
Paul C. Anagnostopoulos 6ca2bdb03c [TableGen] Make the NUL character invalid in .td files
Differential Revision: https://reviews.llvm.org/D101923
2021-05-11 09:20:42 -04:00
Paul C. Anagnostopoulos 985ab6e1fa [TableGen] Fix two bugs in 'defm' when complex 'assert' is involved.
This patch fixes two bugs that arise when a 'defm' inherits from a multiclass
and also from a class with assertions.

Differential Revision: https://reviews.llvm.org/D101626
2021-04-30 11:31:06 -04:00
Paul C. Anagnostopoulos 952c6ddd8b [TableGen] Add the !find bang operator
!find searches a source string for a target string and returns the position.

Differential Revision: https://reviews.llvm.org/D101318
2021-04-28 09:51:00 -04:00
Paul C. Anagnostopoulos ff0ddd5ce4 [TableGen] Remove a TODO comment that is no longer relevant [NFC] 2021-04-26 10:03:12 -04:00
Paul C. Anagnostopoulos 2d4c4d3c54 [TableGen] Change assertion information from a tuple to a struct [NFC]
Differential Revision: https://reviews.llvm.org/D100854
2021-04-26 09:57:16 -04:00
Paul C. Anagnostopoulos 9d609adcb0 [TableGen] Correct some comments in the TableGen parser [NFC]
Differential Revision: https://reviews.llvm.org/D101088
2021-04-23 09:53:31 -04:00
Paul C. Anagnostopoulos a5aaec8f4e [TableGen] Add support for the 'assert' statement in multiclasses
This is step 3 of adding the 'assert' statement.

Differential Revision: https://reviews.llvm.org/D99751
2021-04-19 09:01:42 -04:00
Daniel Sanders be50657c6a [TableGen] Resolve concrete but not complete field access initializers
This fixes the resolution of Rec10.Zero in ListSlices.td.

As part of this, correct the definition of complete for ListInit such that
it's complete iff all the elements in the list are complete rather than
always being complete regardless of the elements. This is the reason
Rec10.TwoFive from ListSlices.td previously resolved despite being
incomplete like Rec10.Zero was

Depends on D100247

Reviewed By: Paul-C-Anagnostopoulos

Differential Revision: https://reviews.llvm.org/D100253
2021-04-13 15:14:56 -07:00
Paul C. Anagnostopoulos 489cdedd11 [TableGen] Fix bug in recent change to ListInit::convertInitListSlice()
Differential Revision: https://reviews.llvm.org/D100247
2021-04-12 09:44:39 -04:00
Alex Richardson 107189a26e [TableGen] Report an error message on a missing comma
I recently forgot a comma in a defm argument list and tablegen just
failed with exit code 1 without printing an error message. I believe
this issue was introduced in a9fc44c557.

This change prints the following instead:
.../clang/include/clang/Driver/Options.td:569:3: error: Expected comma before next argument

Reviewed By: Paul-C-Anagnostopoulos

Differential Revision: https://reviews.llvm.org/D100178
2021-04-09 18:48:49 +01:00
Paul C. Anagnostopoulos 3f919ff250 Revert "[TableGen] Add support for the 'assert' statement in multiclasses"
This reverts commit 3b9a15d910.
2021-04-08 13:58:58 -04:00
Paul C. Anagnostopoulos 14580ce2fd [TableGen] Make behavior of list slice suffix consistent across all values
Differential Revision: https://reviews.llvm.org/D99883
2021-04-08 08:38:44 -04:00
Paul C. Anagnostopoulos 3b9a15d910 [TableGen] Add support for the 'assert' statement in multiclasses 2021-04-08 08:36:03 -04:00
Abhina Sreeskantharajan 1bcf58b213 [SystemZ][z/OS][TableGen] TableGen files should be text
This patch sets tablegen files as text. It should have no effect on Windows after this patch landed https://reviews.llvm.org/rG82b3e28e836d2f5c8cfd6e1047b93c088522365a.

Reviewed By: anirudhp

Differential Revision: https://reviews.llvm.org/D100036
2021-04-07 11:23:00 -04:00
Paul C. Anagnostopoulos 5f473a04af [TableGen] Add support for the 'assert' statement in class definitions.
Differential Revision: https://reviews.llvm.org/D99275
2021-03-29 09:20:29 -04:00
Abhina Sreeskantharajan bc5d4bcc2d [Windows] Turn off text mode in TableGen and Rewriter to stop CRLF translation
This patch should fix the errors shown on the Windows bots by turning off text mode. I plan to investigate a better fix but this should unblock the buildbots for now.

Reviewed By: rnk

Differential Revision: https://reviews.llvm.org/D99363
2021-03-26 07:12:46 -04:00
Abhina Sreeskantharajan c83cd8feef [NFC] Reordering parameters in getFile and getFileOrSTDIN
In future patches I will be setting the IsText parameter frequently so I will refactor the args to be in the following order. I have removed the FileSize parameter because it is never used.

```
  static ErrorOr<std::unique_ptr<MemoryBuffer>>
  getFile(const Twine &Filename, bool IsText = false,
          bool RequiresNullTerminator = true, bool IsVolatile = false);

  static ErrorOr<std::unique_ptr<MemoryBuffer>>
  getFileOrSTDIN(const Twine &Filename, bool IsText = false,
                 bool RequiresNullTerminator = true);

 static ErrorOr<std::unique_ptr<MB>>
 getFileAux(const Twine &Filename, uint64_t MapSize, uint64_t Offset,
            bool IsText, bool RequiresNullTerminator, bool IsVolatile);

  static ErrorOr<std::unique_ptr<WritableMemoryBuffer>>
  getFile(const Twine &Filename, bool IsVolatile = false);
```

Reviewed By: jhenderson

Differential Revision: https://reviews.llvm.org/D99182
2021-03-25 09:47:49 -04:00
Abhina Sreeskantharajan a234d03198 [NFC] Formatting changes
This patch addresses some formatting changes from the comments in https://reviews.llvm.org/D97785.

Reviewed By: anirudhp

Differential Revision: https://reviews.llvm.org/D99072
2021-03-23 07:17:54 -04:00
Paul C. Anagnostopoulos a9fc44c557 [TableGen] Improve handling of template arguments
This requires changes to TableGen files and some C++ files due to
incompatible multiclass template arguments that slipped through
before the improved handling.
2021-03-19 09:57:53 -04:00
Abhina Sreeskantharajan 4f750f6ebc [SystemZ][z/OS] Distinguish between text and binary files on z/OS
This patch consists of the initial changes to help distinguish between text and binary content correctly on z/OS. I would like to get feedback from Windows users on setting OF_None for all ToolOutputFiles. This seems to have been done as an optimization to prevent CRLF translation on Windows in the past.

Reviewed By: zibi

Differential Revision: https://reviews.llvm.org/D97785
2021-03-19 08:09:57 -04:00
Kazu Hirata dd9a641184 [TableGen] Use range-based for loops (NFC) 2021-03-06 15:52:55 -08:00
Paul C. Anagnostopoulos 49d663d546 Revert "[TableGen] Improve algorithms for processing template arguments"
This reverts commit e589207d5aaee6cbf1d7c7de8867a17727d14aca.
2021-02-18 09:26:26 -05:00
Paul C. Anagnostopoulos d248cce44e [TableGen] Improve algorithms for processing template arguments
Rework template argument checking so that all arguments are type-checked
and cast if necessary.

Add a test.

Differential Revision: https://reviews.llvm.org/D96416
2021-02-18 09:15:26 -05:00
Kazu Hirata 910e2d1e57 [llvm] Use llvm::is_contained (NFC) 2021-02-14 08:36:20 -08:00
J-Y You 267b573b55 [TableGen] Fix anonymous record self-reference in foreach and multiclass
If we instantiate self-referenced anonymous records in foreach and
multiclass, the NAME value will point to incorrect record. It's because
anonymous name is resolved too early.

This patch adds AnonymousNameInit to represent an anonymous record name.
When instantiating an anonymous record, it will update the referred name.

Differential Revision: https://reviews.llvm.org/D95309
2021-02-01 10:59:07 -05:00
J-Y You 5046c5be84 [TableGen] Fix instantiating multiclass in foreach
If multiclass argument comes from loop varaible and argument is record type,
it will not recognize the type. This patch ensures that loop variables are
resolved correctly.

Differential Revision: https://reviews.llvm.org/D95308
2021-01-29 10:25:33 -05:00
Paul C. Anagnostopoulos f3449ed607 [TableGen] [DetailedRecords] Print record name that is null string as ""
Differential Revision: https://reviews.llvm.org/D95312

Add a test for the backend.
2021-01-27 10:41:46 -05:00
Kazu Hirata 16baad8f4e [llvm] Use pop_back_val (NFC) 2021-01-24 12:18:57 -08:00
Paul C. Anagnostopoulos 4f5f29d409 Revert "[TableGen] Improve algorithm for inheriting class template args and fields"
This reverts commit c056f82434.

That commit causes build failures.
2021-01-20 09:47:13 -05:00
Paul C. Anagnostopoulos c056f82434 [TableGen] Improve algorithm for inheriting class template args and fields
Differential Revision: https://reviews.llvm.org/D94822
2021-01-20 09:31:43 -05:00
Paul C. Anagnostopoulos a022be6253 [TableGen] Enhance !cast<string> to handle bit and bits types.
Add a test for this.

Differential Revision: https://reviews.llvm.org/D94529
2021-01-14 10:20:35 -05:00
Paul C. Anagnostopoulos a675947712 [TableGen] Improve error message for semicolon after braced body.
Add a test for this message.

Differential Revision: https://reviews.llvm.org/D94412
2021-01-12 09:38:05 -05:00
Paul C. Anagnostopoulos fe50b7363a [TableGen] Fix use of *CurRec when CurRec is null.
I cannot build with the undefined sanitizer on Visual Studio.
2021-01-08 13:21:57 -05:00
Paul C. Anagnostopoulos d4f2fef746 [TableGen] Remove unused declaration that caused build failures. 2021-01-08 10:10:54 -05:00
Paul C. Anagnostopoulos 6e2b6351d2 [TableGen] Add the assert statement, step 1
Differential Revision: https://reviews.llvm.org/D93911

This first step adds the assert statement and supports it at top level
and in record definitions. Later steps will support it in class
definitions and multiclasses.
2021-01-08 09:47:51 -05:00
Paul C. Anagnostopoulos aa7968a87b [TableGen] Add field kind to the RecordVal class.
Differential Revision: https://reviews.llvm.org/D93969
2021-01-07 09:31:27 -05:00
Kazu Hirata 1d0bc05551 [llvm] Use llvm::append_range (NFC) 2021-01-06 18:27:33 -08:00
Kazu Hirata 848e8f938f [llvm] Construct SmallVector with iterator ranges (NFC) 2021-01-04 11:42:44 -08:00
Paul C. Anagnostopoulos 4820af99dd [TableGen] Fix bug in !interleave operator
I forgot to account for unresolved elements of the list.

Differential Revision: https://reviews.llvm.org/D93814
2020-12-28 12:17:24 -05:00
Paul C. Anagnostopoulos e122a71a0a [TableGen] Add the !substr() bang operator
Update the documentation and add a test.

Build failed: Change SIZE_MAX to std::numeric_limits<int64_t>::max().

Differential Revision: https://reviews.llvm.org/D93419
2020-12-23 10:59:33 -05:00
Paul C. Anagnostopoulos 554eb1f6dc Revert "[TableGen] Add the !substr() bang operator"
This reverts commit 3a675c777d.
2020-12-21 10:46:25 -05:00
Paul C. Anagnostopoulos 3a675c777d [TableGen] Add the !substr() bang operator
Update the documentation and add a test.

Differential Revision: https://reviews.llvm.org/D93419
2020-12-21 09:41:59 -05:00
Simon Pilgrim 6c8ded0d8c [TableGen] Don't dereference from dyn_cast<> - use cast<> instead. NFCI.
dyn_cast<> can return null if the cast fails, resulting in null dereferences and static analyzer warnings. We should use cast<> instead.
2020-12-14 12:12:08 +00:00
Paul C. Anagnostopoulos 6266f36226 [TableGen] Cache the vectors of records returned by getAllDerivedDefinitions().
Differential Revision: https://reviews.llvm.org/D92674
2020-12-09 10:54:04 -05:00