[llvm-commits] [PATCH] Add Pattern ID Information
David Greene
dag at cray.com
Wed Aug 3 16:38:14 PDT 2011
I've got a patch series ready to implement support for printing asm comments
about instruction selection. For example:
incq %rdx # test.c:38
# Src: (add:i64 GR64:i64:$src, 1:i64)
# Dst: (INC64r:i64 GR64:i64:$src)
This is really helpful for tracking down isel issues and was invaluable during
AVX implementation and tuning. So I want to get this in before I start doing
the heavy-duty AVX merging.
There are only two patches in the series that are probably worth reviewing
before commit. This is the first. It adds a new field to MachineInstr
to hold an index into a table of strings generated by TableGen. That table
continues the pattern information to dump out for the instruction.
For hosts with 64-bit pointers, this change should not affect the size of
MachineInstr at all. For hosts with 32-bit pointers, it could increase the
size of MachineInstr by 16 or 32 bits depending on how std::vector is
defined.
Since pattern information will only be available in debug builds, I considered
guarding the field with #ifndef NDEBUG but experience tells me to be leery
about defining key data structures differently in debug and non-debug builds.
I am ok adding the guards if folks think that's a good idea.
Comments and suggestions?
-Dave
=============
Add a field to carry an index into a pattern string table for debug
comment printing purposes.
---
llvm/include/llvm/CodeGen/MachineInstr.h | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git old/llvm/include/llvm/CodeGen/MachineInstr.h new/llvm/include/llvm/CodeGen/MachineInstr.h
index 5b3d3ea..b03b5d2 100644
--- old/llvm/include/llvm/CodeGen/MachineInstr.h
+++ new/llvm/include/llvm/CodeGen/MachineInstr.h
@@ -72,6 +72,14 @@ private:
// anything other than to convey comment
// information to AsmPrinter.
+ int16_t PatternIndex; // This is an index into a
+ // table of instruction
+ // pattern strings. The asm
+ // printer uses this index to
+ // get the string it should
+ // print out for pattern match
+ // comments.
+
std::vector<MachineOperand> Operands; // the operands
mmo_iterator MemRefs; // information on memory references
mmo_iterator MemRefsEnd;
--
1.7.6
More information about the llvm-commits
mailing list