blob: 360042d382cdbbef1bc2b94c6975ffcc658df1b6 [file] [log] [blame]
Vitaly Buka410a6b22018-06-07 19:17:46 +00001//===-- cxx_loop_proto.proto - Protobuf description of C++ with for loops -===//
2//
Chandler Carruth2946cd72019-01-19 08:50:56 +00003// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
Vitaly Buka410a6b22018-06-07 19:17:46 +00006//
7//===----------------------------------------------------------------------===//
8///
9/// \file
10/// This file describes a subset of C++ as a protobuf. It is used to
Emmett Neymanba58c3a2018-08-15 23:05:48 +000011/// more easily find interesting inputs for fuzzing LLVM's vectorizer.
12/// This subset differs from the one defined in cxx_proto.proto by eliminating
13/// while loops and conditionals. The goal is that the C++ code generated will
14/// be more likely to stress the LLVM loop vectorizer. The code generated will
15/// contain either a single loop or two nested loops.
Vitaly Buka410a6b22018-06-07 19:17:46 +000016///
17//===----------------------------------------------------------------------===//
18
Vitaly Buka410a6b22018-06-07 19:17:46 +000019syntax = "proto2";
20
Vitaly Buka410a6b22018-06-07 19:17:46 +000021message Const {
22 required int32 val = 1;
23}
24
Matt Morehouse34167732018-06-11 17:05:45 +000025message VarRef {
26 // Add an enum for each array in function signature
27 enum Arr {
28 ARR_A = 0;
29 ARR_B = 1;
30 ARR_C = 2;
31 };
32 required Arr arr = 1;
33}
34
Vitaly Buka410a6b22018-06-07 19:17:46 +000035message BinaryOp {
36 enum Op {
37 PLUS = 0;
38 MINUS = 1;
39 MUL = 2;
Emmett Neymane5f4a9f2018-06-22 18:05:00 +000040 XOR = 3;
41 AND = 4;
42 OR = 5;
43 EQ = 6;
44 NE = 7;
45 LE = 8;
46 GE = 9;
47 LT = 10;
48 GT = 11;
Vitaly Buka410a6b22018-06-07 19:17:46 +000049 };
50 required Op op = 1;
51 required Rvalue left = 2;
52 required Rvalue right = 3;
53}
54
55message Rvalue {
56 oneof rvalue_oneof {
Matt Morehouse1dc1ff82018-06-08 00:33:35 +000057 Const cons = 1;
58 BinaryOp binop = 2;
Matt Morehouse34167732018-06-11 17:05:45 +000059 VarRef varref = 3;
Vitaly Buka410a6b22018-06-07 19:17:46 +000060 }
61}
62
63message AssignmentStatement {
Matt Morehouse34167732018-06-11 17:05:45 +000064 required VarRef varref = 1;
Vitaly Buka410a6b22018-06-07 19:17:46 +000065 required Rvalue rvalue = 2;
66}
67
Vitaly Buka410a6b22018-06-07 19:17:46 +000068message Statement {
Matt Morehouse34167732018-06-11 17:05:45 +000069 required AssignmentStatement assignment = 1;
Vitaly Buka410a6b22018-06-07 19:17:46 +000070}
71
72message StatementSeq {
73 repeated Statement statements = 1;
74}
75
76message LoopFunction {
Emmett Neymanba58c3a2018-08-15 23:05:48 +000077 optional StatementSeq inner_statements = 1;
78 required StatementSeq outer_statements = 2;
Vitaly Buka410a6b22018-06-07 19:17:46 +000079}
80
81package clang_fuzzer;