mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-10 13:51:37 +00:00
[X86] Move the memory unfolding table creation into its own class and make it a ManagedStatic.
Also move the static folding tables, their search functions and the new class into new cpp/h files. The unfolding table is effectively static data. It's just a different ordering and a subset of the static folding tables. By putting it in a separate ManagedStatic we ensure we only have one copy instead of one per X86InstrInfo object. This way also makes it only get initialized when really needed. llvm-svn: 336056
This commit is contained in:
parent
b3927f4cb4
commit
a21f95eb29
@ -43,6 +43,7 @@ set(sources
|
||||
X86IndirectBranchTracking.cpp
|
||||
X86InterleavedAccess.cpp
|
||||
X86InstrFMA3Info.cpp
|
||||
X86InstrFoldTables.cpp
|
||||
X86InstrInfo.cpp
|
||||
X86EvexToVex.cpp
|
||||
X86LegalizerInfo.cpp
|
||||
|
5410
lib/Target/X86/X86InstrFoldTables.cpp
Normal file
5410
lib/Target/X86/X86InstrFoldTables.cpp
Normal file
File diff suppressed because it is too large
Load Diff
85
lib/Target/X86/X86InstrFoldTables.h
Normal file
85
lib/Target/X86/X86InstrFoldTables.h
Normal file
@ -0,0 +1,85 @@
|
||||
//===-- X86InstrFoldTables.h - X86 Instruction Folding Tables ---*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file contains the interface to query the X86 memory folding tables.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_LIB_TARGET_X86_X86INSTRFOLDTABLES_H
|
||||
#define LLVM_LIB_TARGET_X86_X86INSTRFOLDTABLES_H
|
||||
|
||||
#include "llvm/Support/DataTypes.h"
|
||||
|
||||
namespace llvm {
|
||||
|
||||
enum {
|
||||
// Select which memory operand is being unfolded.
|
||||
// (stored in bits 0 - 3)
|
||||
TB_INDEX_0 = 0,
|
||||
TB_INDEX_1 = 1,
|
||||
TB_INDEX_2 = 2,
|
||||
TB_INDEX_3 = 3,
|
||||
TB_INDEX_4 = 4,
|
||||
TB_INDEX_MASK = 0xf,
|
||||
|
||||
// Do not insert the reverse map (MemOp -> RegOp) into the table.
|
||||
// This may be needed because there is a many -> one mapping.
|
||||
TB_NO_REVERSE = 1 << 4,
|
||||
|
||||
// Do not insert the forward map (RegOp -> MemOp) into the table.
|
||||
// This is needed for Native Client, which prohibits branch
|
||||
// instructions from using a memory operand.
|
||||
TB_NO_FORWARD = 1 << 5,
|
||||
|
||||
TB_FOLDED_LOAD = 1 << 6,
|
||||
TB_FOLDED_STORE = 1 << 7,
|
||||
|
||||
// Minimum alignment required for load/store.
|
||||
// Used for RegOp->MemOp conversion.
|
||||
// (stored in bits 8 - 15)
|
||||
TB_ALIGN_SHIFT = 8,
|
||||
TB_ALIGN_NONE = 0 << TB_ALIGN_SHIFT,
|
||||
TB_ALIGN_16 = 16 << TB_ALIGN_SHIFT,
|
||||
TB_ALIGN_32 = 32 << TB_ALIGN_SHIFT,
|
||||
TB_ALIGN_64 = 64 << TB_ALIGN_SHIFT,
|
||||
TB_ALIGN_MASK = 0xff << TB_ALIGN_SHIFT
|
||||
};
|
||||
|
||||
// This struct is used for both the folding and unfold tables. They KeyOp
|
||||
// is used to determine the sorting order.
|
||||
struct X86MemoryFoldTableEntry {
|
||||
uint16_t KeyOp;
|
||||
uint16_t DstOp;
|
||||
uint16_t Flags;
|
||||
|
||||
bool operator<(const X86MemoryFoldTableEntry &RHS) const {
|
||||
return KeyOp < RHS.KeyOp;
|
||||
}
|
||||
bool operator==(const X86MemoryFoldTableEntry &RHS) const {
|
||||
return KeyOp == RHS.KeyOp;
|
||||
}
|
||||
friend bool operator<(const X86MemoryFoldTableEntry &TE, unsigned Opcode) {
|
||||
return TE.KeyOp < Opcode;
|
||||
}
|
||||
};
|
||||
|
||||
// Look up the memory folding table entry for folding a load and a store into
|
||||
// operand 0.
|
||||
const X86MemoryFoldTableEntry *lookupTwoAddrFoldTable(unsigned RegOp);
|
||||
|
||||
// Look up the memory folding table entry for folding a load or store with
|
||||
// operand OpNum.
|
||||
const X86MemoryFoldTableEntry *lookupFoldTable(unsigned RegOp, unsigned OpNum);
|
||||
|
||||
// Look up the memory unfolding table entry for this instruction.
|
||||
const X86MemoryFoldTableEntry *lookupUnfoldTable(unsigned MemOp);
|
||||
|
||||
} // namespace llvm
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
@ -168,32 +168,6 @@ class X86InstrInfo final : public X86GenInstrInfo {
|
||||
X86Subtarget &Subtarget;
|
||||
const X86RegisterInfo RI;
|
||||
|
||||
struct MemOp2RegOpTableTypeEntry {
|
||||
uint16_t MemOp;
|
||||
uint16_t RegOp;
|
||||
uint16_t Flags;
|
||||
|
||||
bool operator<(const MemOp2RegOpTableTypeEntry &RHS) const {
|
||||
return MemOp < RHS.MemOp;
|
||||
}
|
||||
bool operator==(const MemOp2RegOpTableTypeEntry &RHS) const {
|
||||
return MemOp == RHS.MemOp;
|
||||
}
|
||||
friend bool operator<(const MemOp2RegOpTableTypeEntry &TE,
|
||||
unsigned Opcode) {
|
||||
return TE.MemOp < Opcode;
|
||||
}
|
||||
};
|
||||
|
||||
/// MemOp2RegOpTable - Load / store unfolding opcode map.
|
||||
///
|
||||
typedef std::vector<MemOp2RegOpTableTypeEntry> MemOp2RegOpTableType;
|
||||
MemOp2RegOpTableType MemOp2RegOpTable;
|
||||
|
||||
static void AddTableEntry(MemOp2RegOpTableType &M2RTable, uint16_t RegOp,
|
||||
uint16_t MemOp, uint16_t Flags);
|
||||
const MemOp2RegOpTableTypeEntry *lookupUnfoldTable(unsigned MemOp) const;
|
||||
|
||||
virtual void anchor();
|
||||
|
||||
bool AnalyzeBranchImpl(MachineBasicBlock &MBB, MachineBasicBlock *&TBB,
|
||||
|
Loading…
Reference in New Issue
Block a user