[llvm-dev] Instruction namespace

Paul C. Anagnostopoulos via llvm-dev llvm-dev at lists.llvm.org
Wed Dec 2 12:16:44 PST 2020


Yes, ComputeInstrsByEnum is called only once. getInstructionsByEnumValue is called 62 times.

I think I will cache the namespace. There are 227 TargetOpcode instructions at the beginning of the list. No reason to skip by those 22 times.

Is it just me, or should the TargetOpcode namespace have been called the NontargetOpcode namespace?

At 12/2/2020 02:32 PM, Craig Topper wrote:
>I think they all target specific instructions need to be in the same namespace. I think it's part of the instruction just to separate the target specific instructions from the TargetOpcode instructions since otherwise they look the same to tablegen.
>
>getInstructionsByEnumValue() should only compute the list once and that's probably called for other things than just getting the namespace. So I would think only the linear scan matters. That scan has probably gotten longer since global isel started adding G_* opcodes to the beginning of the enum. It's ~40 without G_* and ~230 with G_*. I think the namespace could probably be cached in CodeGenTarget.



More information about the llvm-dev mailing list