[LLVMbugs] [Bug 20128] New: magic numbers in MachineInstr.cpp

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jun 25 15:04:10 PDT 2014


            Bug ID: 20128
           Summary: magic numbers in MachineInstr.cpp
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Common Code Generator Code
          Assignee: unassignedbugs at nondot.org
          Reporter: spatel+llvm at rotateright.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Around line 318:
        if (TiedTo != 15)

Not even a comment about what that '15' means, but later:

Around line 1162:
// MachineOperand::TiedTo is 4 bits wide.
const unsigned TiedMax = 15;

How about defining this constant in MachineOperand.h where the bitfield is

Is there a way to determine bitfield size at compile-time?

If not, then do something like this?

static const unsigned TiedMax = (1 << BITS_IN_TIEDTO_FIELD) - 1;

...and then use that const value in MachineInstr.cpp.

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140625/053bb78c/attachment.html>

More information about the llvm-bugs mailing list