[LLVMbugs] [Bug 11908] New: DFAEmitter in TableGen doesn't handle sentinel transition row properly

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Feb 2 08:35:29 PST 2012


http://llvm.org/bugs/show_bug.cgi?id=11908

             Bug #: 11908
           Summary: DFAEmitter in TableGen doesn't handle sentinel
                    transition row properly
           Product: new-bugs
           Version: trunk
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: bcahoon at codeaurora.org
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


When the DFAPacketizerEmitter code is generating the DFAStateEntryTable from a
target's .td file, the code is not handling the sentinel transition state
properly and generates incorrect index values for the states that occurs after
the sentinel state.  I think only the Hexagon target is affected by this bug.

For example, here's the incorrect entry table.

const unsigned int HexagonDFAStateEntryTable[] = {
0, 7, 13, 19, 25, 31, 38, 45, 52, 58, 62, 68, 75, 82, 86, 90, 97, 97, 103,
109,\
 112, 115, 119, 125, 131, 138, 144, 150, 153, 156, 162, 168, 174, 180, 187,
192\
, 197, 202, 207, 212, 217, 222,
};

There are two entries numbered '97'.  This represents the sentinel transition
state in the DFAStateInputTable.  The second entry needs to be '98' in this
case.

Here's the code in DFAPacketizerEmitter.cpp:

    // If there are no valid transitions from this stage, we need a sentinel
    // transition.
    if (ValidTransitions == StateEntry[i])
      OS << "{-1, -1},";

Although the sentinel state is not valid, we still need to increment
ValidTransitions since that is the index into the DFAStateInputTable.

I have a simple fix for the bug, which I'm going to sent to the commits mailing
list.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list