summaryrefslogtreecommitdiffstats
path: root/llvm/tools
diff options
context:
space:
mode:
authorFrancesco Petrogalli <francesco.petrogalli@arm.com>2019-09-19 17:47:32 +0000
committerFrancesco Petrogalli <francesco.petrogalli@arm.com>2019-09-19 17:47:32 +0000
commitcb032aa2c773469ce6d1702ef2ec9b50e9e13b46 (patch)
tree48acd26c46506d31599022675f5543bb6216fe34 /llvm/tools
parent7a67ed579520993fcd5ee9442db536ae4100bc23 (diff)
downloadbcm5719-llvm-cb032aa2c773469ce6d1702ef2ec9b50e9e13b46.tar.gz
bcm5719-llvm-cb032aa2c773469ce6d1702ef2ec9b50e9e13b46.zip
[SVFS] Vector Function ABI demangling.
This patch implements the demangling functionality as described in the Vector Function ABI. This patch will be used to implement the SearchVectorFunctionSystem (SVFS) as described in the RFC: http://lists.llvm.org/pipermail/llvm-dev/2019-June/133484.html A fuzzer is added to test the demangling utility. Patch by Sumedh Arani <sumedh.arani@arm.com> Differential revision: https://reviews.llvm.org/D66024 llvm-svn: 372343
Diffstat (limited to 'llvm/tools')
-rw-r--r--llvm/tools/vfabi-demangle-fuzzer/CMakeLists.txt7
-rw-r--r--llvm/tools/vfabi-demangle-fuzzer/vfabi-demangler-fuzzer.cpp26
2 files changed, 33 insertions, 0 deletions
diff --git a/llvm/tools/vfabi-demangle-fuzzer/CMakeLists.txt b/llvm/tools/vfabi-demangle-fuzzer/CMakeLists.txt
new file mode 100644
index 00000000000..908364690f5
--- /dev/null
+++ b/llvm/tools/vfabi-demangle-fuzzer/CMakeLists.txt
@@ -0,0 +1,7 @@
+set(LLVM_LINK_COMPONENTS
+ Analysis
+ Support
+)
+add_llvm_fuzzer(vfabi-demangler-fuzzer
+ vfabi-demangler-fuzzer.cpp
+)
diff --git a/llvm/tools/vfabi-demangle-fuzzer/vfabi-demangler-fuzzer.cpp b/llvm/tools/vfabi-demangle-fuzzer/vfabi-demangler-fuzzer.cpp
new file mode 100644
index 00000000000..13657effbbe
--- /dev/null
+++ b/llvm/tools/vfabi-demangle-fuzzer/vfabi-demangler-fuzzer.cpp
@@ -0,0 +1,26 @@
+//===-- vfabi-demangler-fuzzer.cpp - Fuzzer VFABI using lib/Fuzzer ------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// Build tool to fuzz the demangler for the vector function ABI names.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/Analysis/VectorUtils.h"
+
+using namespace llvm;
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
+ const StringRef MangledName((const char *)Data, Size);
+ const auto Info = VFABI::tryDemangleForVFABI(MangledName);
+
+ // Do not optimize away the return value. Inspired by
+ // https://github.com/google/benchmark/blob/master/include/benchmark/benchmark.h#L307-L345
+ asm volatile("" : : "r,m"(Info) : "memory");
+
+ return 0;
+}
OpenPOWER on IntegriCloud