Skip to content

Commit 15222ff

Browse files
committed
Merge branch 'development' into f-RedesignICFG
2 parents cfcb28a + 17ebc83 commit 15222ff

118 files changed

Lines changed: 288 additions & 237 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.docker/Dockerfile.devenv

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
FROM ubuntu:22.04
2+
3+
RUN apt -y update && apt -y upgrade && apt install bash -y
4+
RUN DEBIAN_FRONTEND=noninteractive apt -y install wget gpg software-properties-common lsb-release git make python3 python3-pip vim -y
5+
RUN apt -y update && apt -y install cmake clang-14 ninja-build sudo
6+
7+
RUN pip install pre-commit
8+
9+
RUN set -exu; \
10+
useradd -p test -s /bin/bash -m vscode; \
11+
groupadd docker; \
12+
usermod -aG docker vscode; \
13+
usermod -aG sudo vscode;
14+
15+
USER vscode
16+
17+
ENV CC "/usr/bin/clang-14"
18+
ENV CXX "/usr/bin/clang++-14"
19+
ENV CMAKE_GENERATOR "Ninja"

.docker/config.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"dockerfile": "Dockerfile.devenv"
3+
}

Brewfile

Lines changed: 0 additions & 9 deletions
This file was deleted.

README.md

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -73,31 +73,9 @@ Done!
7373

7474

7575
### Installing PhASAR a MacOS system
76-
Mac OS 10.13.1 or higher only!
77-
To install the framework on a Mac we will rely on Homebrew. (https://brew.sh/)
78-
79-
Please follow the instructions down below.
80-
81-
```
82-
$ brew install boost
83-
$ brew install python3
84-
# Install llvm version 10
85-
$ brew install llvm
86-
# Setting the paths
87-
# Use LLVM's Clang rather than Apple's Clang compiler
88-
$ export CC=/usr/local/opt/llvm/bin/clang
89-
$ export CXX=/usr/local/opt/llvm/bin/clang++
90-
# Set PATH env variable to /usr/local/opt/llvm/bin
91-
# Go to PhASAR directory run the following commands
92-
$ git submodule init
93-
$ git submodule update
94-
$ mkdir build
95-
$ cd build/
96-
$ cmake -DCMAKE_BUILD_TYPE=Release ..
97-
$ make -j $(nproc) # or use a different number of cores to compile it
98-
$ sudo make install # if you wish a system-wise installation
99-
```
100-
76+
Due to unfortunate updates to MacOS and the handling of C++, especially on the newer M1 processors, we can't support native development on Mac.
77+
The easiest solution to develop PhASAR on a Mac right now is to use [dockers development environments](https://docs.docker.com/desktop/dev-environments/). Clone this repository as described in their documentation. Afterwards, you have to login once manually, as a root user by running `docker exec -it -u root <container name> /bin/bash` to complete the rest of the install process as described in this readme (install submodules, run bootstrap.sh, ...).
78+
Now you can just attach your docker container to VS Code or any other IDE, which supports remote development.
10179

10280
### Compiling PhASAR (if not already done using the installation scripts)
10381
Set the system's variables for the C and C++ compiler to clang:

include/phasar/Controller/AnalysisController.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ enum class AnalysisControllerEmitterOptions : uint32_t {
4949
EmitPTAAsText = (1 << 11),
5050
EmitPTAAsDot = (1 << 12),
5151
EmitPTAAsJson = (1 << 13),
52+
EmitStatisticAsJson = (1 << 14),
5253
};
5354

5455
class AnalysisController {

include/phasar/DB/ProjectIRDB.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include "llvm/IR/PassManager.h"
2222
#include "llvm/Passes/PassBuilder.h"
2323

24+
#include "nlohmann/json.hpp"
2425
#include "phasar/Utils/EnumFlags.h"
2526

2627
namespace llvm {
@@ -61,6 +62,8 @@ class ProjectIRDB {
6162
// Maps an id to its corresponding instruction
6263
std::map<std::size_t, llvm::Instruction *> IDInstructionMapping;
6364
size_t NumGlobals = 0;
65+
size_t NumberCallsites = 0;
66+
nlohmann::json StatsJson;
6467

6568
void buildIDModuleMapping(llvm::Module *M);
6669

@@ -173,6 +176,10 @@ class ProjectIRDB {
173176
return IDInstructionMapping.size();
174177
}
175178

179+
[[nodiscard]] inline std::size_t getNumCallsites() const {
180+
return NumberCallsites;
181+
}
182+
176183
[[nodiscard]] std::size_t getNumGlobals() const;
177184

178185
[[nodiscard]] std::size_t getNumFunctions() const;
@@ -181,6 +188,8 @@ class ProjectIRDB {
181188

182189
[[nodiscard]] static std::size_t getInstructionID(const llvm::Instruction *I);
183190

191+
void printAsJson(llvm::raw_ostream &OS = llvm::outs()) const;
192+
184193
void print() const;
185194

186195
void emitPreprocessedIR(llvm::raw_ostream &OS = llvm::outs(),
@@ -224,6 +233,11 @@ class ProjectIRDB {
224233
persistedStringToValue(const std::string &StringRep) const;
225234
};
226235

236+
/**
237+
* Revserses the getMetaDataID function
238+
*/
239+
const llvm::Value *fromMetaDataId(const ProjectIRDB &IRDB, llvm::StringRef Id);
240+
227241
} // namespace psr
228242

229243
#endif

include/phasar/PhasarLLVM/ControlFlow/LLVMBasedCFG.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,15 @@
1212

1313
#include "phasar/PhasarLLVM/ControlFlow/CFGBase.h"
1414

15+
#include "nlohmann/json.hpp"
16+
1517
#include "llvm/ADT/STLExtras.h"
1618
#include "llvm/ADT/SmallVector.h"
1719
#include "llvm/IR/InstIterator.h"
1820
#include "llvm/IR/InstrTypes.h"
1921
#include "llvm/IR/Instructions.h"
2022

2123
namespace llvm {
22-
class Instruction;
2324
class Function;
2425
} // namespace llvm
2526

include/phasar/PhasarLLVM/ControlFlow/Resolver/Resolver.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "llvm/ADT/DenseSet.h"
2121

2222
#include <memory>
23+
#include <optional>
2324
#include <string>
2425

2526
namespace llvm {

include/phasar/PhasarLLVM/DataFlowSolver/IfdsIde/InitialSeeds.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#include <type_traits>
1616

1717
#include "phasar/PhasarLLVM/Utils/BinaryDomain.h"
18-
#include "phasar/Utils/LLVMShorthands.h"
18+
#include "phasar/PhasarLLVM/Utils/LLVMShorthands.h"
1919

2020
namespace psr {
2121

include/phasar/PhasarLLVM/DataFlowSolver/IfdsIde/LLVMFlowFunctions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
#include "phasar/PhasarLLVM/DataFlowSolver/IfdsIde/FlowFunctions.h"
2323
#include "phasar/PhasarLLVM/DataFlowSolver/IfdsIde/LLVMZeroValue.h"
24-
#include "phasar/Utils/LLVMShorthands.h"
24+
#include "phasar/PhasarLLVM/Utils/LLVMShorthands.h"
2525

2626
namespace llvm {
2727
class Value;

0 commit comments

Comments
 (0)