[llvm] [SandboxIR][Doc] Add a Doc file for Sandbox IR (PR #98691)

via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 12 16:33:59 PDT 2024


================
@@ -0,0 +1,53 @@
+# Sandbox IR: A transactional layer over LLVM IR
+
+Sandbox IR is an IR layer on top of LLVM IR that allow you to save/restore its state.
+
+# API
+The Sandbox IR API is designed to make it feel like LLVM.
+So Sandbox IR replicates many common API classes and functions to mirror the LLVM API.
+The class hierarchy is quite similar (but in the `sandboxir` namespace), for example here is a small part of it:
+```
+namespace sandboxir {
+              Value
+              /  \
+            User BasicBlock ...
+           /   \
+  Instruction Constant
+        /
+     ...
+}
+```
+
+Sandbox IR is also using a similar type system with `isa<>, cast<>, dyn_cast<>`.
+
+# Design
+
+## Sandbox IR Value <-> LLVM IR Value Mapping
+LLVM IR and Sandbox IR are always in sync.
----------------
vporpo wrote:

I expanded on that a bit.

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


More information about the llvm-commits mailing list