[llvm] [SandboxIR][NFC] SingleLLVMInstructionImpl class (PR #102687)
Jorge Gorbe Moya via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 9 15:17:40 PDT 2024
================
@@ -713,27 +713,43 @@ class Instruction : public sandboxir::User {
#endif
};
-class SelectInst : public Instruction {
- /// Use Context::createSelectInst(). Don't call the
- /// constructor directly.
- SelectInst(llvm::SelectInst *CI, Context &Ctx)
- : Instruction(ClassID::Select, Opcode::Select, CI, Ctx) {}
- friend Context; // for SelectInst()
+/// Instructions that contain a single LLVM Instruction can inherit from this.
+class SingleLLVMInstructionImpl : public Instruction {
----------------
slackito wrote:
It would be nice if we could go a little further and have `verify()` and `dump()` here as well to remove some more repetition.
The cast in `verify` should be doable using CRTP, but I don't have any good idea for the `"Expected SomeInst"` message that doesn't involve macros and operand stringification, which is a bit ugly.
https://github.com/llvm/llvm-project/pull/102687
More information about the llvm-commits
mailing list