summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@intel.com>2018-06-25 20:11:16 +0000
committerCraig Topper <craig.topper@intel.com>2018-06-25 20:11:16 +0000
commit614f1924716f85ba0a08bf8dcb2effa817d761cf (patch)
tree696d004c1eb79b3a44e2aa52739fb02e69a6effb
parent41dd6ced2c8323aa804c3aed57f120746ab7f3fc (diff)
downloadbcm5719-llvm-614f1924716f85ba0a08bf8dcb2effa817d761cf.tar.gz
bcm5719-llvm-614f1924716f85ba0a08bf8dcb2effa817d761cf.zip
[X86] Add comment about the sorting of the memory folding tables added in r335501.
llvm-svn: 335517
-rw-r--r--llvm/lib/Target/X86/X86InstrInfo.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/llvm/lib/Target/X86/X86InstrInfo.cpp b/llvm/lib/Target/X86/X86InstrInfo.cpp
index d5577acde90..94d381a1901 100644
--- a/llvm/lib/Target/X86/X86InstrInfo.cpp
+++ b/llvm/lib/Target/X86/X86InstrInfo.cpp
@@ -120,6 +120,21 @@ struct X86MemoryFoldTableEntry {
}
};
+// 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.
+//
+// We also have a tablegen emitter that tries to autogenerate these tables
+// by comparing encoding information. This can be enabled by passing
+// X86_GEN_FOLD_TABLES=ON to cmake which fill produce X86GenFoldTables.inc
+// in the build area. There are currently some bugs in the autogenerated table
+// that require a manual review to copy them from the autogenerated table into
+// this table. It is unclear if we will ever be able to fully automate this
+// because as new instruction are added into holes in the X86 opcode map they
+// potentially pair up with old instructions and create new entries in the
+// tables that would be incorrect. The manual review process allows us a chance
+// to catch these before they become observable bugs.
static const X86MemoryFoldTableEntry MemoryFoldTable2Addr[] = {
{ X86::ADC16ri, X86::ADC16mi, 0 },
{ X86::ADC16ri8, X86::ADC16mi8, 0 },
OpenPOWER on IntegriCloud