1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00
llvm-mirror/tools/vfabi-demangle-fuzzer/vfabi-demangler-fuzzer.cpp
Francesco Petrogalli bb6e7b26a0 [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
2019-09-19 17:47:32 +00:00

27 lines
995 B
C++

//===-- 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;
}