[llvm] [SandboxIR] Boilerplate code (PR #95814)

via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 21 09:11:19 PDT 2024


================
@@ -0,0 +1,141 @@
+//===- SandboxIR.h ----------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// Sandbox IR is a lightweight overlay transactional IR on top of LLVM IR.
+// Features:
+// - You can save/rollback the state of the IR at any time.
+// - Any changes made to Sandbox IR will automatically update the underlying
+//   LLVM IR so both IRs are always in sync.
+// - Feels like LLVM IR, similar API.
+//
+// SandboxIR forms a class hierarchy that resembles that of LLVM IR
+// but is in the `sandboxir` namespace:
+//
+//        +- Argument   +- Constant     +- OpaqueInst
+//        |             |               |
+// Value -+- User ------+- Instruction -+- InsertElementInst
+//        |                             |
+//        +- BasicBlock                 +- ExtractElementInst
+//        |                             |
+//        +- Function                   +- ShuffleVectorInst
+//                                      |
+//                                      +- StoreInst
+//                                      |
+//                                      +- LoadInst
+//                                      |
+//                                      +- CmpInst
+//                                      |
+//                                      +- CastInst
+//                                      |
+//                                      +- PHINode
+//                                      |
+//                                      +- SelectInst
+//                                      |
+//                                      +- BinaryOperator
+//                                      |
+//                                      +- UnaryOperator
+//
+// Use
+//
+#ifndef LLVM_TRANSFORMS_SANDBOXIR_SANDBOXIR_H
+#define LLVM_TRANSFORMS_SANDBOXIR_SANDBOXIR_H
+
+#include "llvm/IR/User.h"
+#include "llvm/IR/Value.h"
+#include "llvm/Support/raw_ostream.h"
+
+namespace llvm {
+
+namespace sandboxir {
+
+class Context;
+
+/// A SBValue has users. This is the base class.
----------------
vporpo wrote:

Good catch, there is also one in the patch description.

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


More information about the llvm-commits mailing list