summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Fuzzer/FuzzerTracePC.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Fuzzer/FuzzerTracePC.cpp')
-rw-r--r--llvm/lib/Fuzzer/FuzzerTracePC.cpp49
1 files changed, 0 insertions, 49 deletions
diff --git a/llvm/lib/Fuzzer/FuzzerTracePC.cpp b/llvm/lib/Fuzzer/FuzzerTracePC.cpp
index ddfee218f3b..ed411f1164b 100644
--- a/llvm/lib/Fuzzer/FuzzerTracePC.cpp
+++ b/llvm/lib/Fuzzer/FuzzerTracePC.cpp
@@ -272,55 +272,6 @@ void TracePC::HandleCmp(void *PC, T Arg1, T Arg2) {
HandleValueProfile(Idx);
}
-void TracePC::ProcessTORC(Dictionary *Dict, const uint8_t *Data, size_t Size) {
- TORCToDict(TORC8, Dict, Data, Size);
- TORCToDict(TORC4, Dict, Data, Size);
-}
-
-template <class T>
-void TracePC::TORCToDict(const TableOfRecentCompares<T, kTORCSize> &TORC,
- Dictionary *Dict, const uint8_t *Data, size_t Size) {
- ScopedDoingMyOwnMemmem scoped_doing_my_own_memmem;
- for (size_t i = 0; i < TORC.kSize; i++) {
- T A[2] = {TORC.Table[i][0], TORC.Table[i][1]};
- if (!A[0] && !A[1]) continue;
- for (int j = 0; j < 2; j++)
- TORCToDict(Dict, A[j], A[!j], Data, Size);
- }
-}
-
-template <class T>
-void TracePC::TORCToDict(Dictionary *Dict, T FindInData, T Substitute,
- const uint8_t *Data, size_t Size) {
- if (FindInData == Substitute) return;
- if (sizeof(T) == 4) {
- uint16_t HigherBytes = Substitute >> sizeof(T) * 4;
- if (HigherBytes == 0 || HigherBytes == 0xffff)
- TORCToDict(Dict, static_cast<uint16_t>(FindInData),
- static_cast<uint16_t>(Substitute), Data, Size);
- }
- const size_t DataSize = sizeof(T);
- const uint8_t *End = Data + Size;
- int Attempts = 3;
- for (int DoSwap = 0; DoSwap <= 1; DoSwap++) {
- for (const uint8_t *Cur = Data; Cur < End && Attempts--; Cur++) {
- Cur = (uint8_t *)memmem(Cur, End - Cur, &FindInData, DataSize);
- if (!Cur)
- break;
- size_t Pos = Cur - Data;
- Word W(reinterpret_cast<uint8_t *>(&Substitute), sizeof(Substitute));
- DictionaryEntry DE(W, Pos);
- // TODO: evict all entries from Dic if it's full.
- Dict->push_back(DE);
- // Printf("Dict[%zd] TORC%zd %llx => %llx pos %zd\n", Dict->size(),
- // sizeof(T),
- // (uint64_t)FindInData, (uint64_t)Substitute, Pos);
- }
- FindInData = Bswap(FindInData);
- Substitute = Bswap(Substitute);
- }
-}
-
} // namespace fuzzer
extern "C" {
OpenPOWER on IntegriCloud