[llvm] [SandboxIR] Implement BitCastInst (PR #101227)

via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 30 19:15:40 PDT 2024


================
@@ -1386,6 +1390,27 @@ class PtrToIntInst final : public CastInst {
 #endif // NDEBUG
 };
 
+class BitCastInst : public CastInst {
+public:
+  static Value *create(Value *Src, Type *DestTy, BBIterator WhereIt,
+                       BasicBlock *WhereBB, Context &Ctx,
+                       const Twine &Name = "");
+  static Value *create(Value *Src, Type *DestTy, Instruction *InsertBefore,
+                       Context &Ctx, const Twine &Name = "");
+  static Value *create(Value *Src, Type *DestTy, BasicBlock *InsertAtEnd,
+                       Context &Ctx, const Twine &Name = "");
+
+  static bool classof(const Value *From) {
+    if (auto *I = dyn_cast<Instruction>(From))
+      return I->getOpcode() == Instruction::Opcode::BitCast;
----------------
vporpo wrote:

I will push an NFC to make this consistent with the rest. Though I still think that the isa + cast pattern looks a bit nicer as it is less verbose.

https://github.com/llvm/llvm-project/pull/101227


More information about the llvm-commits mailing list