[llvm] [SandboxIR] Adds BasicBlock and adds functionality to Function and Context (PR #97637)
Arthur Eubanks via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 8 11:30:40 PDT 2024
================
@@ -278,12 +381,55 @@ class Context {
DenseMap<llvm::Value *, std::unique_ptr<sandboxir::Value>>
LLVMValueToValueMap;
+ /// Take ownership of VPtr and store it in `LLVMValueToValueMap`.
+ Value *registerValue(std::unique_ptr<Value> &&VPtr);
+
+ /// Helper for avoiding recursion loop when creating SBConstants.
+ SmallDenseSet<llvm::Constant *, 8> VisitedConstants;
+
+ Value *getOrCreateValueInternal(llvm::Value *V, int Depth,
+ llvm::User *U = nullptr);
+
+ template <typename SBT, typename LLVMT>
+ SBT *getOrCreateGeneric(LLVMT *LLVMV) {
----------------
aeubanks wrote:
is the constructor of SBT always going to take `(LLVMT, Context)` as the arguments? e.g. LLVM Values have different constructor param lists so it doesn't make sense to templatize these sorts of builders in that context (pun intended)
https://github.com/llvm/llvm-project/pull/97637
More information about the llvm-commits
mailing list