[all-commits] [llvm/llvm-project] 034f2b: [SandboxIR] Implement SandboxIR Type (#106294)

vporpo via All-commits all-commits at lists.llvm.org
Thu Aug 29 17:19:34 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 034f2b380bd2d84e8cfbcb647b50602711d170c7
      https://github.com/llvm/llvm-project/commit/034f2b380bd2d84e8cfbcb647b50602711d170c7
  Author: vporpo <vporpodas at google.com>
  Date:   2024-08-29 (Thu, 29 Aug 2024)

  Changed paths:
    M llvm/include/llvm/SandboxIR/SandboxIR.h
    A llvm/include/llvm/SandboxIR/Type.h
    M llvm/lib/SandboxIR/CMakeLists.txt
    M llvm/lib/SandboxIR/SandboxIR.cpp
    A llvm/lib/SandboxIR/Type.cpp
    M llvm/unittests/SandboxIR/CMakeLists.txt
    M llvm/unittests/SandboxIR/SandboxIRTest.cpp
    M llvm/unittests/SandboxIR/TrackerTest.cpp
    A llvm/unittests/SandboxIR/TypesTest.cpp

  Log Message:
  -----------
  [SandboxIR] Implement SandboxIR Type (#106294)

This patch implements sandboxir::Type, a thin wrapper of llvm::Type.
This is designed very similarly to sandbox::Value. Context owns all
sandboxir::Type objects and maintains a map between llvm::Type and
sandboxir::Type.

There are a couple of reasons for migrating from llvm::Type to
sandboxir::Type:
- Creating an llvm::Type from within SandboxIR-only code doesn't work
well because it requires you to pass llvm::Context to functions like
llvm::Type::getInt32Ty(C), but you wouldn't normally have access to
llvm::Context C. In unit tests this is not such a big deal because you
have access to both, but it will become an issue in SandboxIR-only code.
- Not being able to get the sandboxir::Context from llvm::Type results
in awkward sandboir APIs with additional sandboxir::Context arguments.
- llvm::Type::getContext() can basically give you access to the whole
LLVM IR, which we should try to avoid.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list