| 1 |
#include "automemcpy/CodeGen.h" |
| 2 |
#include "automemcpy/RandomFunctionGenerator.h" |
| 3 |
#include <optional> |
| 4 |
#include <unordered_set> |
| 5 |
|
| 6 |
namespace llvm { |
| 7 |
namespace automemcpy { |
| 8 |
|
| 9 |
std::vector<FunctionDescriptor> generateFunctionDescriptors() { |
| 10 |
std::unordered_set<FunctionDescriptor, FunctionDescriptor::Hasher> Seen; |
| 11 |
std::vector<FunctionDescriptor> FunctionDescriptors; |
| 12 |
RandomFunctionGenerator P; |
| 13 |
while (std::optional<FunctionDescriptor> MaybeFD = P.next()) { |
| 14 |
FunctionDescriptor FD = *MaybeFD; |
| 15 |
if (Seen.count(FD)) // FIXME: Z3 sometimes returns twice the same object. |
| 16 |
continue; |
| 17 |
Seen.insert(FD); |
| 18 |
FunctionDescriptors.push_back(std::move(FD)); |
| 19 |
} |
| 20 |
return FunctionDescriptors; |
| 21 |
} |
| 22 |
|
| 23 |
} // namespace automemcpy |
| 24 |
} // namespace llvm |
| 25 |
|
| 26 |
int main(int, char **) { |
| 27 |
llvm::automemcpy::Serialize(llvm::outs(), |
| 28 |
llvm::automemcpy::generateFunctionDescriptors()); |
| 29 |
} |