Skip to content

Sync pybind with upstream Semi-Sparse refactor + LLVM 21.1.0#48

Merged
bjjwwang merged 1 commit intoSVF-tools:mainfrom
bjjwwang:sync-llvm-21
Apr 30, 2026
Merged

Sync pybind with upstream Semi-Sparse refactor + LLVM 21.1.0#48
bjjwwang merged 1 commit intoSVF-tools:mainfrom
bjjwwang:sync-llvm-21

Conversation

@bjjwwang
Copy link
Copy Markdown
Collaborator

Upstream commit 0aa951d (Semi-Sparse infrastructure) moved a group of methods off AbstractState onto the new AbstractStateManager. The pybind bindings still pointed at the deleted methods, so the wheel no longer compiled against current SVF.

pybind/AE.cpp:

  • Drop 9 stale AbstractState bindings: getByteOffset, getElementIndex, loadValue, storeValue, getPointeeElement, getGepObjAddrs (twice), getAllocaInstByteSize.
  • Add py::class_ with 18 methods: getAbstractValue, hasAbstractValue, updateAbstractValue (each with ValVar/ObjVar/SVFVar overloads), getAbstractState, hasAbstractState, updateAbstractState, getGepElementIndex, getGepByteOffset, getGepObjAddrs, loadValue, storeValue, getPointeeElement, getAllocaInstByteSize, getTrace, getitem, getUseSitesOfObjVar / ValVar, getDefSiteOfObjVar / ValVar. Constructor takes (SVFIR*, std::shared_ptr).
  • Add minimal py::class_ exposing getStateMgr() so Python users can grab a stateMgr from a running analysis.
  • Add py::class_ with the max_field_limit() static (used by downstream Assignment-3 helpers when porting getByteOffset).

pybind/SVFIR.cpp:

  • Add GepStmt::getStructFieldOffset(idx_var, struct_type) lambda binding, needed to faithfully port AbstractStateManager::getGepByteOffset to Python without losing the struct-field path.

pysvf/init.py: re-export AbstractStateManager, AbstractInterpretation, Options from .pysvf so they show up at the package top level.

setup.py + workflows: bump LLVM 18.1.0 -> 21.1.0 paths everywhere (setup.py also had stale llvm-16.0.0.obj remnants; consolidated to llvm-21.1.0.obj). The npm svf-lib URL must point at LLVM 21 too -- SVF-npm sync-llvm-21 covers that.

BREAKING (release notes worthy): callers of pysvf.AbstractState that relied on as.loadValue / as.storeValue / as.getByteOffset / etc. must migrate to a stateMgr. New signatures take ValVar*/ObjVar* + ICFGNode* instead of NodeID. See SSA Assignment-3 sync-llvm-21 for an example migration that reproduces the dense-mode behavior locally.

Upstream commit 0aa951d (Semi-Sparse infrastructure) moved a group of
methods off AbstractState onto the new AbstractStateManager. The pybind
bindings still pointed at the deleted methods, so the wheel no longer
compiled against current SVF.

pybind/AE.cpp:
- Drop 9 stale AbstractState bindings: getByteOffset, getElementIndex,
  loadValue, storeValue, getPointeeElement, getGepObjAddrs (twice),
  getAllocaInstByteSize.
- Add py::class_<AbstractStateManager> with 18 methods: getAbstractValue,
  hasAbstractValue, updateAbstractValue (each with ValVar/ObjVar/SVFVar
  overloads), getAbstractState, hasAbstractState, updateAbstractState,
  getGepElementIndex, getGepByteOffset, getGepObjAddrs, loadValue,
  storeValue, getPointeeElement, getAllocaInstByteSize, getTrace,
  __getitem__, getUseSitesOfObjVar / ValVar, getDefSiteOfObjVar / ValVar.
  Constructor takes (SVFIR*, std::shared_ptr<AndersenWaveDiff>).
- Add minimal py::class_<AbstractInterpretation> exposing getStateMgr() so
  Python users can grab a stateMgr from a running analysis.
- Add py::class_<Options> with the max_field_limit() static (used by
  downstream Assignment-3 helpers when porting getByteOffset).

pybind/SVFIR.cpp:
- Add GepStmt::getStructFieldOffset(idx_var, struct_type) lambda binding,
  needed to faithfully port AbstractStateManager::getGepByteOffset to
  Python without losing the struct-field path.

pysvf/__init__.py: re-export AbstractStateManager, AbstractInterpretation,
Options from .pysvf so they show up at the package top level.

setup.py + workflows: bump LLVM 18.1.0 -> 21.1.0 paths everywhere
(setup.py also had stale llvm-16.0.0.obj remnants; consolidated to
llvm-21.1.0.obj). The npm svf-lib URL must point at LLVM 21 too --
SVF-npm sync-llvm-21 covers that.

BREAKING (release notes worthy): callers of pysvf.AbstractState that
relied on as.loadValue / as.storeValue / as.getByteOffset / etc. must
migrate to a stateMgr. New signatures take ValVar*/ObjVar* + ICFGNode*
instead of NodeID. See SSA Assignment-3 sync-llvm-21 for an example
migration that reproduces the dense-mode behavior locally.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@bjjwwang bjjwwang merged commit cc5b348 into SVF-tools:main Apr 30, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant