Commit Graph

487690 Commits

Author SHA1 Message Date
Rot127
f5c4f04bd6 Check in patterns for memory operand properties.
- Determine memory operands by there membership of patterns.

Operands can be defined via patterns. The pattern has a type itself.
Patterns are commonly used to define memory operands
(as a collection of multiple other operands).

Here we check, if the operand is part of a pattern with type iPTR.
Type iPTR indicates a memory operand.

- Search for unspecified instruction patterns and extract memory op info from them.

AArch64 has the case of patterns which are not set in the CGI class.
Instead those patterns are free floating in the record keeper.

With this commit we first collect all such unassigned patterns and save them in a map
(indexed by instruction name they belong to).

When instruction operand details are generated, the operand type is searched in the pattern of the instruction.
If there is an operand with the same type in the pattern, which is also of a iPTR pattern, we treat it as memory operand.

Note that we can not compare the operands of the instruction and the pattern operands by name.
Because they simply are not named the same way.

This is a short coming in the td files and should be addressed in LLVM.
Because it is enormiously hard to get a 1 to 1 mapping from a pattern to an instruction
and its operands.
2024-05-29 08:31:35 +00:00
Rot127
162c1c0002 Initialize DecoderComplete flag in generated decoder function. 2024-05-29 08:31:35 +00:00
Rot127
b025bae5cf Assign enum value to the raw_val member to prevent compiler warnings. 2024-05-29 08:31:35 +00:00
Rot127
d386558ab6 Remove check for same name, different signature functions. 2024-05-29 08:31:35 +00:00
Rot127
a35941283f Add AdrLabel and AdrpLable to OP_GROUPS 2024-05-29 08:31:35 +00:00
Rot127
2be2c0fed8 Add MatrixIndex_... to the OP_GROUP list 2024-05-29 08:31:35 +00:00
Rot127
04b82d5399 Fix template function translation 2024-05-29 08:31:35 +00:00
Rot127
86c1c566e6 Fix: Don't return NULL for a struct 2024-05-29 08:31:35 +00:00
Rot127
1318024d0c Format code 2024-05-29 08:31:35 +00:00
Rot127
2e51e2eded Generate InstDecs tables with references to the OpInfo structs. 2024-05-29 08:31:35 +00:00
Rot127
f3c60336ba Add default argument for printSVERegOp 2024-05-29 08:31:35 +00:00
Rot127
a7d6b2f4e1 Define the InstrTable as own type 2024-05-29 08:31:35 +00:00
Rot127
1d9e607d63 Remove asserts 2024-05-29 08:31:35 +00:00
Rot127
9cbe1f3883 Add missing include guard to ignore list. 2024-05-29 08:31:35 +00:00
Rot127
9b0af77cd4 Extends docs 2024-05-29 08:31:35 +00:00
Rot127
1beb1667d4 Enable EmitMapTable to print C tables. 2024-05-29 08:31:35 +00:00
Rot127
100ca315f2 Remove instruction encoding information. 2024-05-29 08:31:35 +00:00
Rot127
d77b8e1e18 Fix no-return values warning from compiler. 2024-05-29 08:31:35 +00:00
Rot127
77cde4e9bb Fix mismatch in generated C++ SystemOperands files. 2024-05-29 08:31:35 +00:00
Rot127
3d027d2146 Fix mismatch in C++ Subtarget files 2024-05-29 08:31:35 +00:00
Rot127
b9cb107187 Fix mismatches in generated C++ code. 2024-05-29 08:31:35 +00:00
Rot127
31564d0004 Remove syntax check, because it doesn't work that easy. 2024-05-29 08:31:35 +00:00
Rot127
38c9f1312a Make gen scripts use the repository root dir. 2024-05-29 08:31:35 +00:00
Rot127
1a0c3b2478 Fix some incorrectly generated source code after rebase. 2024-05-29 08:31:35 +00:00
Rot127
01fe52b2cc Fix workflows 2024-05-29 08:31:35 +00:00
Rot127
4d0bf508b2 Separate generating of tables into different scripts so we can use Github action for branch checkout. 2024-05-29 08:31:35 +00:00
Rot127
4392b8b518 Add build instructions 2024-05-29 08:31:35 +00:00
Rot127
7416021692 Build debug llvm-tblgen in CI 2024-05-29 08:31:35 +00:00
Rot127
147ee550e6 Fix some incorrect generated LLVM code. 2024-05-29 08:31:35 +00:00
Rot127
e1baf17a75 Use Python provided cmake and Ninja for CI build and select gnu compiler 12 2024-05-29 08:31:35 +00:00
Rot127
994c2a0930 Don't dump output of build in /dev/null 2024-05-29 08:31:35 +00:00
Rot127
d8f1e22274 Fix incorrect use of variable. 2024-05-29 08:31:35 +00:00
Rot127
b0ada691e5 Blind fix for Github CI build 2024-05-29 08:31:35 +00:00
Rot127
662c781584 Add a rebuild options and print more logs 2024-05-29 08:31:35 +00:00
Rot127
903e412a23 Update our def files to follow 4b43ef3e5c 2024-05-29 08:31:35 +00:00
Rot127
8c89272eb9 Add missing closing brackets in PPC def files. 2024-05-29 08:31:35 +00:00
Rot127
5fd0c79cde Add missing commandline options for refactored backends. 2024-05-29 08:31:35 +00:00
Rot127
f272345239 Add table compare script to CI. 2024-05-29 08:31:35 +00:00
Rot127
c1109258ea Add CI jobs from main auto-sync branch again. 2024-05-29 08:31:35 +00:00
Rot127
d0eb6ed7d1 Add script to check syntax and compare LLVM upstream and our tables. 2024-05-29 08:31:35 +00:00
Rot127
c0317ac800 Rebase refactored TableGen backends onto LLVM 18.
The MCInstDesc table changed. Bsides this only minor changes were done
and some additional code is emitted now for LLVM.

This commit is the combination of all previous Auto-Sync commits.
The list of commit messages follows:

-----------

Combination of all commits of the refactored tablegen backends.

These are the changes made for LLVM 16.

Refactor Capstone relevant TableGen Emitter backends.

This commit extracts the code which emits generated tables into two printer classes.
The Printer is called whenever actual code is written to a file.
There is the PrinterLLVM which emits tht code as before and
PrinterCapstone which is tailored to or needs (emitting C and generates
more info).

Additionally missing memory access properties were added to ARMs td
files.

Emit a single header for all files.

Captialize Target name for enums.

Add lay metric to emit enum value for Banked and system regs.

Malloc substr

Sort instructions in ascending order.

Free substr after use

Add vanished constrainsts

Fix `regInfoEmitEnums()` and indent

Fix `GenDisassemblerTables.inc#checkDecoderPredicate()`

Fix `TriCoreGenRegisterInfo.inc` | `PrinterCapstone::regInfoEmitRegClasses`

revert changes to NEON instructions

Add instructions with duplicate operands as Matchables.

Add memory load and store info

Correct memory access and out operand info

Set register lists again as read ops due to https://github.com/llvm/llvm-project/issues/62455

Make printAliasInstr and getMnemonic static.

Generate CS instruction enums from actual mnemonic. Not via the flawed AsmMatcher.

Fix typo in InstrInfoEmitter.cpp

Add deprecated QPX feature

Replace + and - with p and m

Add AssemblerPredicates to PPC

Generate RegEncodingTable

Define functions which are called by the Mapper as static.

Necessary because these functions are present in each arch'

Remove set_mem_access().

The cases where this is used to mark access to actual memory operands are
either very rare, or those are neon lane indicies.

Generate correct op type for absolute addresses.

Check for RegisterPointer operands first to prevent mis-categorization.

Add missing Operand types

Generate Instruction formats for PPC.

Add Paired Single instructions.

Partly revert 94e41ce23a7fd863a96288ec05b6c7202c3cfbf1 (introduces accidentially removed code.)

Set correct operand types for PS operands

Add memory read/write attributes

Add missing operand types

Add mayLoad and mayStore information.

Add documentation.

Handle special AArch64 operand

Replace C++ with C code.

Check for duplicate enum instr. names

Check for duplicate defintions of system registers.

Add note about missing target names.

Resolve templates in a single static method and add docs about it.

Revert printing target name in upper case.

Revert partially C++ syntax fixes in .td files.

They break the TemplateCOllector since it searches for exactly those references but can't find any'

Add all SubtargetFeatures to feature enum.

Not just the one used by CGIs.

Pass Decoder

Enable to check specific table fields to determine if reg enum must be emitted.

Allow to add namespace to type name/

Formatting

Rework emitting of tables.

The system operands are now emitted in reg, imm and aliass groups.
Also a bug was fixed which emitted incorrect code..

Check for rename IMPLICIT_IMM operand types

Pass DecodeComplete as pointer not as reference

Print undef when it needs to be printed.

Add namespace ids to all types and functions.

Rework C translation.

Pass MCOp as pointer not as ref

Add missing SysImm type

Fix syntax mistakes

Generate additonal sys immediates and op groups.

Handle edge case for printSVERegOp

Handle default arguments of template functions.

Add two missing op groups

Generate a static RecEncodingTable

Set enum values to encodings of the sys ops

Generate a single Enum value file for system operands.

Replace System operand groups with their operand types

Fix missing braces warning

Emit MCOperand validator.

Emit lookupByName functions for sys operands

Add namespaces for ARM.

Check for Target if default arguments of template functions are resolved.

auto-sync opcode & operand encoding info generation (#14)

* Added operand and opcode info generation

* Wrapped deprecated macro under an intellisense check

Basically intellisense fails, causing multiple errors in other files,

so when intellisense parses the code it will use the different version of the macro

* Fixed a small bug

Used double braces to prevent an old bug

Removed extra new line and fixed a bug regarding move semantics
2024-05-29 08:31:35 +00:00
Yingwei Zheng
7fd9979eb9 [InstCombine] Drop UB-implying attrs/metadata after speculating an instruction (#85542)
When speculating an instruction in `InstCombinerImpl::FoldOpIntoSelect`,
the call may result in undefined behavior. This patch drops all
UB-implying attrs/metadata to fix this.

Fixes #85536.

(cherry picked from commit 252d01952c087cf0d141f7f281cf60efeb98be41)
2024-03-17 06:20:57 +00:00
Weining Lu
edbe7fa5fe [lld][LoongArch] Fix handleUleb128
(cherry picked from commit a41bcb3930534ef1525b4fc30e53e818b39e2b60)
2024-03-16 18:28:00 -07:00
Weining Lu
b95ea2e51b [lld][test] Fix sanitizer buildbot failure
Buildbot failure:
https://lab.llvm.org/buildbot/#/builders/5/builds/41530/steps/9/logs/stdio

(cherry picked from commit d9b435c24ddddcc8148fd97b42f6bb1124e52307)
2024-03-16 18:28:00 -07:00
Daniel Paoliello
2f640ad26d Remove support for EXPORTAS in def files to maintain ABI compatibility for COFFShortExport 2024-03-16 15:55:54 -07:00
Daniel Paoliello
207ecd684c [Arm64EC] Copy import descriptors to the EC Map (#84834)
As noted in <https://github.com/llvm/llvm-project/pull/78537>, MSVC
places import descriptors in both the EC and regular map - that PR moved
the descriptors to ONLY the regular map, however this causes linking
errors when linking as Arm64EC:

```
bcryptprimitives.lib(bcryptprimitives.dll) : error LNK2001: unresolved external symbol __IMPORT_DESCRIPTOR_bcryptprimitives (EC Symbol)
```

This change copies import descriptors from the regular map to the EC
map, which fixes this linking error.
2024-03-16 15:55:54 -07:00
Jacek Caban
79bc8b32c6 [llvm-lib][Object] Add support for EC importlib symbols. (#81059)
ARM64EC import libraries expose two additional symbols: mangled thunk
symbol (like `#func`) and auxiliary import symbol (like`__imp_aux_func`).
The main functional change with this patch is that those symbols are
properly added to static library ECSYMBOLS.
2024-03-16 15:55:54 -07:00
Jacek Caban
76e1800f35 [llvm-lib][llvm-dlltool][Object] Add support for EXPORTAS name types. (#78772)
EXPORTAS is a new name type in import libraries. It's used by default on ARM64EC,
but it's allowed on other platforms as well.
2024-03-16 15:55:54 -07:00
Jacek Caban
77e1992e89 [llvm-readobj][Object][COFF] Print COFF import library symbol export name. (#78769)
getExportName implementation is based on lld-link. In its current form,
it's mostly about convenience, but it will be more useful for EXPORTAS
support, for which export name is not possible to deduce from other
printed properties.
2024-03-16 15:55:54 -07:00
Louis Dionne
3a06861272
[libc++] Use clang-tidy version that matches the compiler we use in the CI (#85305)
This works around ODR violations in the clang-tidy plugin we use to
perform the modules tests.

Fixes #85242
2024-03-16 15:32:44 -07:00