minor patch to fix 'random` tblgen -gen-inst-enums-bug

Hi *,

to decide in which namespace tablegen should place the
instruction-enum, tablegen iterates over CodeGenTarget instructions
until it finds an Instruction with a namespace other than
"TargetInstInfo".. but this is wrong, as internal Instructions now use
"TargetOpcode" as Namespace..

As Instructions are a map, it is only by chance which is the first
instruction it finds - either a user-defined, everything okay - or an
internal, which results code like

namespace llvm {
namespace TargetOpcode {
  enum {
    PHI = 0,
...

which of course cant compile...

Attached patch fixes the issue.

Best regards,

Thomas

TblGen.patch (1.32 KB)

Hi *,

to decide in which namespace tablegen should place the
instruction-enum, tablegen iterates over CodeGenTarget instructions
until it finds an Instruction with a namespace other than
"TargetInstInfo".. but this is wrong, as internal Instructions now use
"TargetOpcode" as Namespace..

Is this patch against mainline? The patch doesn't apply and I don't see anything even close to that code in that file.

-Chris