Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Please use the below guidelines to run the code
clang -S sample.c -emit-llvm -o file.ll
opt -load ./build/libLoadStoreAnalysisPass.so -loadstoreanalysis -S hello.ll -enable-new-pm=0
PROBLEM1:
Write an LLVM analysis pass that identifies load/store instructions within each function in the program. The pass should be able to handle different memory access patterns, such as direct loads/stores, pointer arithmetic, and nested structures.
PROBLEM2:
In the pass described in #21, determine details of the memory being accessed, such as the type and size.
For each memory location being accessed, track the total amount of memory accessed and the number of times the memory is accessed (i.e. frequency).
PROBLEM3:
Provide a neat report of the memory access patterns for each function, including the memory locations being accessed, the amount of data being accessed and the number of times the location is accessed.
An example output expected from the pass would be something like:
file1.c:foo()
myArray: 12 bytes (3 times)
myStruct.field1: 8 bytes (2 times)
myArray2: 4 bytes (1 time)
myStruct.field2: 8 bytes (2 times)
file2.c:bar()
myArray3: 24 bytes (3 times)
myStruct.field2: 16 bytes (4 times)