1 | //===-- cxx_loop_proto.proto - Protobuf description of C++ with for loops -===// |
2 | // |
3 | // 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 |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | /// |
9 | /// \file |
10 | /// This file describes a subset of C++ as a protobuf. It is used to |
11 | /// 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. |
16 | /// |
17 | //===----------------------------------------------------------------------===// |
18 | |
19 | syntax = "proto2"; |
20 | |
21 | message Const { |
22 | required int32 val = 1; |
23 | } |
24 | |
25 | message 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 | |
35 | message BinaryOp { |
36 | enum Op { |
37 | PLUS = 0; |
38 | MINUS = 1; |
39 | MUL = 2; |
40 | 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; |
49 | }; |
50 | required Op op = 1; |
51 | required Rvalue left = 2; |
52 | required Rvalue right = 3; |
53 | } |
54 | |
55 | message Rvalue { |
56 | oneof rvalue_oneof { |
57 | Const cons = 1; |
58 | BinaryOp binop = 2; |
59 | VarRef varref = 3; |
60 | } |
61 | } |
62 | |
63 | message AssignmentStatement { |
64 | required VarRef varref = 1; |
65 | required Rvalue rvalue = 2; |
66 | } |
67 | |
68 | message Statement { |
69 | required AssignmentStatement assignment = 1; |
70 | } |
71 | |
72 | message StatementSeq { |
73 | repeated Statement statements = 1; |
74 | } |
75 | |
76 | message LoopFunction { |
77 | optional StatementSeq inner_statements = 1; |
78 | required StatementSeq outer_statements = 2; |
79 | } |
80 | |
81 | package clang_fuzzer; |
82 | |