Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2nd PR. Add SVF's byte size and fix some api use #1260

Merged
merged 14 commits into from
Nov 28, 2023

Conversation

bjjwwang
Copy link
Contributor

No description provided.

jiawei.wang and others added 10 commits November 24, 2023 23:52
2) add isStaticDeterminedByteSize and getByteSizeOfObj in ObjTypeInfo (with getter/setter) and MemObj(only getter)
3) fulfill SymbolTableBuilder::initTypeInfo() to init the ByteSize related field
2) fix a bug in IntervalValue compare Op
3) remove ConstantOffset bool flag. Instead, if byteSize != 0, it is signal of constant offset. If byteSize = 0, it can be zero byte size or non-const offset.
4) add analyzeHeapAllocByteSize(const Value*), which accepts a CallInst like (malloc/calloc/..) and analyze the allocation byte Size of heap function
5) remove the hard code (99999) of maxByteLimit in SVFIR2ItvExeState::getBytefromGepTypePair, and replace it with Options::MaxFieldLimit()
2) add getByteSize and SetByteSize in SVFType
Copy link

codecov bot commented Nov 27, 2023

Codecov Report

Merging #1260 (1b5b780) into master (0e6935b) will decrease coverage by 0.02%.
Report is 1 commits behind head on master.
The diff coverage is 78.78%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1260      +/-   ##
==========================================
- Coverage   64.50%   64.49%   -0.02%     
==========================================
  Files         223      223              
  Lines       23767    23766       -1     
==========================================
- Hits        15331    15327       -4     
- Misses       8436     8439       +3     
Files Coverage Δ
svf-llvm/lib/LLVMModule.cpp 82.61% <100.00%> (-0.60%) ⬇️
svf-llvm/lib/LLVMUtil.cpp 75.64% <ø> (-0.20%) ⬇️
svf/include/MemoryModel/AccessPath.h 83.33% <ø> (ø)
svf/include/SVFIR/SVFStatements.h 83.00% <ø> (ø)
svf/include/SVFIR/SVFType.h 95.65% <100.00%> (ø)
svf/include/SVFIR/SymbolTableInfo.h 92.30% <ø> (ø)
svf/lib/SVFIR/SVFFileSystem.cpp 78.73% <100.00%> (ø)
svf/lib/SVFIR/SVFType.cpp 0.00% <ø> (ø)
svf-llvm/lib/SymbolTableBuilder.cpp 86.48% <71.42%> (ø)
svf/lib/MemoryModel/AccessPath.cpp 3.52% <0.00%> (-0.05%) ⬇️

@@ -74,7 +74,7 @@ class SVFIR2ItvExeState
VAddrs getGepObjAddress(u32_t pointer, APOffset offset);

/// Return the byte offset from one gep param offset
std::pair<APOffset, APOffset> getBytefromGepTypePair(const AccessPath::VarAndGepTypePair& gep_pair, const GepStmt *gep);
IntervalValue getBytefromGepTypePair(const AccessPath::VarAndGepTypePair& gep_pair, const GepStmt *gep);

/// Return the Index offset from one gep param offset
std::pair<APOffset, APOffset> getIndexfromGepTypePair(const AccessPath::VarAndGepTypePair& gep_pair, const GepStmt *gep);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getItvOfFlattenedElemIndex

@@ -74,7 +74,7 @@ class SVFIR2ItvExeState
VAddrs getGepObjAddress(u32_t pointer, APOffset offset);

/// Return the byte offset from one gep param offset
std::pair<APOffset, APOffset> getBytefromGepTypePair(const AccessPath::VarAndGepTypePair& gep_pair, const GepStmt *gep);
IntervalValue getBytefromGepTypePair(const AccessPath::VarAndGepTypePair& gep_pair, const GepStmt *gep);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getByteOffset

@@ -84,7 +84,7 @@ class SVFIR2ItvExeState
/// e.g. GepStmt* gep = [i32*10], x, and x is [0,3]
/// std::pair<s32_t, s32_t> byteOffset = getGepByteOffset(gep);
/// byteOffset should be [0, 12] since i32 is 4 bytes.
std::pair<APOffset, APOffset> getGepByteOffset(const GepStmt *gep);
IntervalValue getGepByteOffset(const GepStmt *gep);

/// Return the offset expression of a GepStmt
std::pair<APOffset, APOffset> getGepOffset(const GepStmt *gep);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getItvOfFlattenedElemIndex

@@ -74,7 +74,7 @@ class SVFIR2ItvExeState
VAddrs getGepObjAddress(u32_t pointer, APOffset offset);

/// Return the byte offset from one gep param offset
std::pair<APOffset, APOffset> getBytefromGepTypePair(const AccessPath::VarAndGepTypePair& gep_pair, const GepStmt *gep);
IntervalValue getBytefromGepTypePair(const AccessPath::VarAndGepTypePair& gep_pair, const GepStmt *gep);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VarAndGepTypePair => IdxVarAndGepTypePair

@yuleisui yuleisui merged commit 914e226 into SVF-tools:master Nov 28, 2023
5 checks passed
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.

2 participants