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

opaque pointer support (type inference) for c #1323

Merged
merged 77 commits into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
f3761ea
find type assert
jumormt Jan 6, 2024
18970cb
add assertion checking num field
jumormt Jan 6, 2024
40b8def
fix indirect call does not have called func
jumormt Jan 6, 2024
19fc337
add type check option
jumormt Jan 8, 2024
f57fc37
add type check option && first version of collect types
jumormt Jan 8, 2024
f38e36a
add "store (value operand) <- gep" rule
jumormt Jan 8, 2024
9c8d789
add inter-procedural rule
jumormt Jan 8, 2024
8e13066
add some comments
jumormt Jan 8, 2024
5144f86
fix call base bug
jumormt Jan 8, 2024
fae7e57
add callsite to callee inference
jumormt Jan 8, 2024
8934f21
do not propagate to declare func
jumormt Jan 8, 2024
4fcfafe
fix vararg
jumormt Jan 8, 2024
14efeb5
refactor
jumormt Jan 9, 2024
27fb0ea
use hash map to cache results
jumormt Jan 9, 2024
2e6d12d
refine
jumormt Jan 9, 2024
6f62afb
iterative memorizing dfs
jumormt Jan 9, 2024
7279bee
iterative memorizing dfs
jumormt Jan 9, 2024
5edb5f2
fix bug
jumormt Jan 9, 2024
3138be2
add comments and fix bug for c++20
jumormt Jan 9, 2024
7cad38a
fix deadloop
jumormt Jan 9, 2024
cc5f2aa
fix deadloop
jumormt Jan 9, 2024
28b941e
refine coding
jumormt Jan 9, 2024
f1cab1a
refactor inferTypeOfHeapObjOrStaticObj
jumormt Jan 9, 2024
8c838bf
refactor inferTypeOfHeapObjOrStaticObj
jumormt Jan 9, 2024
87b671c
add a new typeinference class
jumormt Jan 10, 2024
d38f373
refactor
jumormt Jan 10, 2024
076ca38
fix bug
jumormt Jan 10, 2024
8d15f3f
add debug support
jumormt Jan 10, 2024
cf89135
add default type
jumormt Jan 10, 2024
4712b6b
move getptrelementtype to test
jumormt Jan 10, 2024
550ebb1
move getClassNameOfThisPtr to chg builder and add diff test
jumormt Jan 10, 2024
3063af8
remove getelementptr in SVFExt and llvmmodule
jumormt Jan 10, 2024
376d729
return max field for ptr type
jumormt Jan 11, 2024
fd0e4d4
default for heap is i8
jumormt Jan 11, 2024
9a89761
for param of ext api, first find source and then derive type
jumormt Jan 11, 2024
868e023
refactor getOrInferLLVMObjType
jumormt Jan 11, 2024
9f45f32
skip global function value -> callsite when forward infer type
jumormt Jan 11, 2024
578a379
update comment
jumormt Jan 11, 2024
ef078d7
fix passing a function as a param
jumormt Jan 11, 2024
8889fd0
rename typesizedifftest, remove unnecessary getfirstcast
jumormt Jan 12, 2024
ef8ccd1
remove getptrelement and getpointerto in svf/*
jumormt Jan 12, 2024
058f626
ptr in svf main
jumormt Jan 12, 2024
b13b37f
thisptr class name prepare
jumormt Jan 12, 2024
8639716
infer type based on c++ constructor
jumormt Jan 13, 2024
ec19b79
add comments
jumormt Jan 13, 2024
1d33ec4
getOrInferThisPtrClassName update
jumormt Jan 13, 2024
d17948b
refine type diff test
jumormt Jan 14, 2024
5f35694
refine type diff test
jumormt Jan 14, 2024
1d52b55
fix indirect call passing
jumormt Jan 14, 2024
f854a53
separate cpp source and allocation
jumormt Jan 15, 2024
1857464
refactor iscpp constructor
jumormt Jan 15, 2024
a243d10
update
jumormt Jan 15, 2024
8efc471
for c++ fw type inference, consider constructor for now
jumormt Jan 15, 2024
04d89a8
update
jumormt Jan 15, 2024
f3a4f8e
delete c++
jumormt Jan 15, 2024
6cf0f73
delete c++
jumormt Jan 15, 2024
146fbd8
update based on comments
jumormt Jan 16, 2024
ab8963d
rename
jumormt Jan 16, 2024
ab04330
refactor
jumormt Jan 17, 2024
0aeeacb
reformat
jumormt Jan 17, 2024
76cdfc3
refactor
jumormt Jan 17, 2024
22dd059
move typeinference to LLVMModuleSet
jumormt Jan 21, 2024
12b3431
release llvm modouleset immediately after svfir is built
jumormt Jan 21, 2024
7352b98
remove static method
jumormt Jan 21, 2024
c363ad3
fix ander diff test
jumormt Jan 21, 2024
6ffb132
fix saber
jumormt Jan 21, 2024
3cdc19e
bytesize default 1
jumormt Jan 24, 2024
37f43f2
fix wpa release llvm module
jumormt Jan 24, 2024
8118f53
fix mac CI
jumormt Jan 24, 2024
eb34d0a
delete cpp
jumormt Jan 24, 2024
a176ca5
move release llvmmoduleset to the end of main
jumormt Jan 24, 2024
63aa46e
merge SVF master into opaque c
jumormt Jan 24, 2024
4d2f565
rename typeinference to objtypeinference
jumormt Jan 25, 2024
82f2e31
enable type check by default
jumormt Jan 25, 2024
9e61dd0
refactor
jumormt Jan 25, 2024
b0980a0
rename cpp and add ctest type infer CI
jumormt Jan 25, 2024
d620c42
add some assertions for npd
jumormt Jan 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
delete c++
  • Loading branch information
jumormt committed Jan 24, 2024
commit f3a4f8e2664b185d060a1ff1832752bf11e0ab96
27 changes: 0 additions & 27 deletions svf-llvm/include/SVF-LLVM/TypeInference.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,6 @@ class TypeInference {
ValueToInferSites _valueToInferSites; // value inference site cache
ValueToType _valueToType; // value type cache
ValueToSources _valueToAllocs; // value allocations (stack, static, heap) cache
ValueToSources _valueToCPPSources; // value cpp sources cache
ValueToClassName _thisPtrClassName; // thisptr class name cache
std::string _emptyClassName = "";

explicit TypeInference() = default;

Expand All @@ -71,16 +68,11 @@ class TypeInference {
/// get or infer the type of a value
const Type *getOrInferLLVMObjType(const Value *startValue);
Copy link
Collaborator

Choose a reason for hiding this comment

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

InferObjType


/// get or infer the name of thisptr
const std::string &getOrInferThisPtrClassName(const Value *thisPtr);

/// Validate type inference
void validateTypeCheck(const CallBase *cs);

void typeSizeDiffTest(const PointerType *oPTy, const Type *iTy, const Value *val);

void typeDiffTest(const PointerType *oPTy, const Type *iTy, const Value *val);

/// Default type
static const Type *defaultTy(const Value *val);

Expand All @@ -101,32 +93,13 @@ class TypeInference {
/// Backward collect all possible allocation sites (stack, static, heap) starting from a value
Set<const Value *> bwGetOrfindAllocations(const Value *startValue);
Copy link
Collaborator

Choose a reason for hiding this comment

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

bwInferObjType


/// Backward collect all possible cpp constructors starting from a value
Set<const Value *> bwGetOrfindCPPSources(const Value *startValue);

/// Determine type based on infer site
static const Type *infersiteToType(const Value *val);

static const std::string extractClassNameViaCppCallee(const Function *callee);

static const Type *cppClassNameToType(const std::string &className);

static const std::string typeToCppClassName(const Type *ty);

inline static bool isAllocation(const Value *val) {
return LLVMUtil::isObject(val);
}

inline static bool isCPPSource(const Value *val);

static bool matchMangler(const std::string &str, const std::string &label);

static bool isCPPConstructor(const std::string &str);

static bool isCPPSTLAPI(const std::string &str);

static bool isCPPDynCast(const std::string &str);

};
}
#endif //SVF_TYPEINFERENCE_H
2 changes: 0 additions & 2 deletions svf-llvm/lib/CHGBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -683,8 +683,6 @@ std::string CHGBuilder::getClassNameOfThisPtr(const CallBase* inst)
if (const StructType *st = SVFUtil::dyn_cast<StructType>(getPtrElementType(ptrTy))) {
thisPtrClassName = getClassNameFromType(st);
}
// TODO: infer class name of thisptr
// thisPtrClassName = TypeInference::getTypeInference()->getOrInferThisPtrClassName(thisPtr);
}
}

Expand Down
Loading