//===-- X86InstrFoldTables.cpp - X86 Instruction Folding Tables -----------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This file contains the X86 memory folding tables. // //===----------------------------------------------------------------------===// #include "X86InstrFoldTables.h" #include "X86InstrInfo.h" #include "llvm/ADT/STLExtras.h" #include <atomic> #include <vector> usingnamespacellvm; // These tables are sorted by their RegOp value allowing them to be binary // searched at runtime without the need for additional storage. The enum values // are currently emitted in X86GenInstrInfo.inc in alphabetical order. Which // makes sorting these tables a simple matter of alphabetizing the table. #include "X86GenFoldTables.inc" // Table to map instructions safe to broadcast using a different width from the // element width. static const X86FoldTableEntry BroadcastSizeTable2[] = …; static const X86FoldTableEntry BroadcastSizeTable3[] = …; static const X86FoldTableEntry * lookupFoldTableImpl(ArrayRef<X86FoldTableEntry> Table, unsigned RegOp) { … } const X86FoldTableEntry *llvm::lookupTwoAddrFoldTable(unsigned RegOp) { … } const X86FoldTableEntry *llvm::lookupFoldTable(unsigned RegOp, unsigned OpNum) { … } const X86FoldTableEntry *llvm::lookupBroadcastFoldTable(unsigned RegOp, unsigned OpNum) { … } namespace { // This class stores the memory unfolding tables. It is instantiated as a // function scope static variable to lazily init the unfolding table. struct X86MemUnfoldTable { … }; } // namespace const X86FoldTableEntry *llvm::lookupUnfoldTable(unsigned MemOp) { … } namespace { // This class stores the memory -> broadcast folding tables. It is instantiated // as a function scope static variable to lazily init the folding table. struct X86BroadcastFoldTable { … }; } // namespace bool llvm::matchBroadcastSize(const X86FoldTableEntry &Entry, unsigned BroadcastBits) { … } const X86FoldTableEntry * llvm::lookupBroadcastFoldTableBySize(unsigned MemOp, unsigned BroadcastBits) { … }