[llvm-dev] Instruction namespace

Krzysztof Parzyszek via llvm-dev llvm-dev at lists.llvm.org
Wed Dec 2 12:31:04 PST 2020


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

A non-target opcode would be Instruction::getOpcode.  MachineInstr stuff is "target".

--
Krzysztof Parzyszek  kparzysz at quicinc.com   AI tools development

-----Original Message-----
From: llvm-dev <llvm-dev-bounces at lists.llvm.org> On Behalf Of Paul C. Anagnostopoulos via llvm-dev
Sent: Wednesday, December 2, 2020 2:17 PM
To: Craig Topper <craig.topper at gmail.com>
Cc: llvm-dev <llvm-dev at lists.llvm.org>
Subject: [EXT] Re: [llvm-dev] Instruction namespace

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.

_______________________________________________
LLVM Developers mailing list
llvm-dev at lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev


More information about the llvm-dev mailing list