X86 PseudoI instructions do not have the isPseudo bit.
Details
- Reviewers
- None
Diff Detail
- Repository
- rL LLVM
- Build Status
Buildable 15671 Build 15671: arc lint + arc unit
Event Timeline
The isPseudo flag is supposed to refer to instructions that are expand by the ExpandPostRAPseudos pass.
While PseudoI class in X86 just means that instruction lacks encoding information. There are at least 3 reasons for this that I know of. The instruction is marked as usesCustomInserter=1 which means it will be replaced shortly after isel. Its handled by the ExpandPostRAPseudos in X86InstrInfo.cpp. And the third reason is that its mutated by the switch in X86MCInstLower::Lower.
If we set isPseudo on the third group, then we end up calling expandPostRAPseudos on them and assume it won't do anything to them and wont' error for an unexpected instruction. I believe we don't check for unexpected instruction because the target independent instructions like COPY, SUBREG_TO_REG, EXTRACT_SUBREG, and INSERT_SUBREG all call X86InstrInfo::expandPostRAPseudos to give the X86 backend a chance to handle them, but X86 doesn't want to.
What is your motivation here? Are you planning to use the flag for something else?
@craig.topper thank you very much for the detailed answer. It makes a lot more sense now.
I'm writing some instruction benchmarking code that goes through all opcodes (0 to INSTRUCTION_LIST_END)
I'm filtering out the isPseudo ones in particular and was surprised that some instructions were not generating any assembly (e.g. PCMPESTRIREG).
I can probably use X86II::Pseudo to remove those instructions then.
I'll drop this patch.