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

Sriraman Tallam via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 12 18:07:26 PDT 2024


================
@@ -0,0 +1,52 @@
+# Sandbox IR: A transactional layer over LLVM IR
+
+Sandbox IR is an IR layer on top of LLVM IR that allows you to save/restore its state.
+
+# API
+The Sandbox IR API is designed to feel like LLVM, replicating many common API classes and functions to mirror the LLVM API.
+The class hierarchy is similar (but in the `llvm::sandboxir` namespace), for example here is a small part of it:
+```
+namespace sandboxir {
+              Value
+              /  \
+            User BasicBlock ...
+           /   \
+  Instruction Constant
+        /
+     ...
+}
+```
+
+# Design
+
+## Sandbox IR Value <-> LLVM IR Value Mapping
+Each LLVM IR Value maps to a single Sandbox IR Value.
+The reverse is also true in most cases, except for multi-Instruction Sandbox IR Instructions that may be defined in extensions the Sandbox IR.
----------------
tmsri wrote:

"except for multi-Instruction Sandbox IR Instructions that may be defined in extensions the Sandbox IR."

Could you rephrase?

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


More information about the llvm-commits mailing list