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
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)
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.
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.
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.
When resolving names inside templates that implement recursive
compile-time functions (e.g. waldo<N>::type is defined in terms
of waldo<N-1>::type), HeuristicResolver could get into an infinite
recursion, specifically one where resolveDependentNameType() can
be called recursively with the same DependentNameType*.
To guard against this, HeuristicResolver tracks, for each external
call into a HeuristicResolver function, the set of DependentNameTypes
that it has seen, and bails if it sees the same DependentNameType again.
To implement this, a helper class HeuristicResolverImpl is introduced
to store state that persists for the duration of an external call into
HeuristicResolver (but does not persist between such calls).
Fixes https://github.com/clangd/clangd/issues/1951
(cherry picked from commit e6e53ca8470d719882539359ebe3ad8b442a8cb0)
On Apple platforms, some of the stddef.h types are also declared in
system headers. In particular NULL has a conflicting declaration in
<sys/_types/_null.h>. When that's in a different module from
<__stddef_null.h>, redeclaration errors can occur.
Make the \_\_stddef_ headers be non-modular in
-fbuiltin-headers-in-system-modules and restore them back to not
respecting their header guards. Still define the header guards though.
__stddef_max_align_t.h was in _Builtin_stddef_max_align_t prior to the
addition of _Builtin_stddef, and it needs to stay in a module because
struct's can't be type merged. __stddef_wint_t.h didn't used to have a
module, but leave it in it current module since it doesn't really belong
to stddef.h.
(cherry picked from commit f50d3582b4844b86ad86372028e44b52c560ec7d)
27ce26b066 added the new option
-fvisibility-global-new-delete=, where -fvisibility-global-new-delete=force-hidden
is equivalent to the old option -fvisibility-global-new-delete-hidden.
At the same time, the old option was deprecated.
Test for and use the new option form first; if unsupported, try
using the old form.
This avoids warnings in the MinGW builds, if built with Clang 18 or
newer.
(cherry picked from commit 1f973efd335f34c75fcba1ccbe288fd5ece15a64)
#69295 demoted Defined symbols relative to discarded sections.
If such a symbol is unreferenced, the desired behavior is to
eliminate it from .symtab just like --gc-sections discarded
definitions.
Linux kernel's CONFIG_DEBUG_FORCE_WEAK_PER_CPU=y configuration expects
that the unreferenced `unused` is not emitted to .symtab
(https://github.com/ClangBuiltLinux/linux/issues/2006).
For relocations referencing demoted symbols, the symbol index restores
to 0 like older lld (`R_X86_64_64 0` in `discard-section.s`).
Fix#85048
(cherry picked from commit 8fe3e70e810b409dce36f6d415e86f0f9b1cf22d)
When inlining across functions with different target features, we
perform roughly two checks:
1. The caller features must be a superset of the callee features.
2. Calls in the callee cannot use types where the target features would
change the call ABI (e.g. by changing whether something is passed in a
zmm or two ymm registers). The latter check is very crude right now.
The latter check currently also catches inline asm "calls". I believe
that inline asm should be excluded from this check, as it is independent
from the usual call ABI, and instead governed by the inline asm
constraint string.
Fixes https://github.com/llvm/llvm-project/issues/67054.
(cherry picked from commit e84182af919d136d74b75ded4d599b38fb47dfb0)
At the moment, getUnderlyingObjects simply continues for phis that do
not refer to the same underlying object in loops, without adding them to
the list of underlying objects, effectively ignoring those phis.
Instead of ignoring those phis, add them to the list of underlying
objects. This fixes a miscompile where LoopAccessAnalysis fails to
identify a memory dependence, because no underlying objects can be found
for a set of memory accesses.
Fixes https://github.com/llvm/llvm-project/issues/82665.
PR: https://github.com/llvm/llvm-project/pull/84339
(cherry picked from commit b274b23665dec30f3ae4fb83ccca8b77e6d3ada3)
The current test-release.sh script does not install the necessary
compiler-rt builtin's during Phase 1 on AIX, resulting on a
non-functional Phase 1 clang. Futhermore, the installation is also
necessary for Phase 2 on AIX.
Co-authored-by: Alison Zhang <alisonzhang@ibm.com>
(cherry picked from commit 3af5c98200e0b1268f755c3f289be4f73aac4214)
The TranspBlocks set was used to cache aliasing decision for all
processed loads in the parent loop. This is incorrect, because each load
can access a different location, which means one load not being modified
in a block doesn't translate to another load not being modified in the
same block.
All loads access the same underlying object, so we could perhaps use a
location without size for all loads and retain the cache, but that would
mean we loose precision.
For now, just drop the cache.
Fixes https://github.com/llvm/llvm-project/issues/84807
PR: https://github.com/llvm/llvm-project/pull/84835
(cherry picked from commit bba4a1daff6ee09941f1369a4e56b4af95efdc5c)
This makes a difference when linking executables with delay loaded
libraries for arm32; the delay loader implementation can load data from
the registry with instructions that assume alignment.
This issue does not show up when linking in MinGW mode, because a
PseudoRelocTableChunk gets injected, which also sets alignment, even if
the chunk itself is empty.
(cherry picked from commit c93c76b562784926b22a69d3f82a5032dcb4a274)
762f762504/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp (L394-L407)
Comment from @topperc:
> This transforms assumes the mask is a non-zero splat. We only know its
a splat and not provably all 0s. The mask is a constexpr that includes
the address of the global variable. We can't resolve the constant
expression to an exact value.
Fixes#83947.
The `MSB` must not be greater than `GRLen`. Without this patch, newly
added test cases will crash with LoongArch32, resulting in a 'cannot
select' error.
(cherry picked from commit edd4c6c6dca4c556de22b2ab73d5bfc02d28e59b)
__has_extension(...) doesn't work as intended when -pedantic-errors is
used with Clang. With that flag, __has_extension(...) is equivalent to
__has_feature(...), which means that checks like
__has_extension(pragma_clang_attribute_external_declaration)
will return 0. In turn, this has the effect of disabling availability
markup in libc++, which is undesirable.
rdar://124078119
(cherry picked from commit 292a28df6c55679fad0589dea35278a8c66b2ae1)