Vitaly Buka | 410a6b2 | 2018-06-07 19:17:46 +0000 | [diff] [blame] | 1 | //===-- cxx_loop_proto.proto - Protobuf description of C++ with for loops -===// |
| 2 | // |
Chandler Carruth | 2946cd7 | 2019-01-19 08:50:56 +0000 | [diff] [blame] | 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 |
Vitaly Buka | 410a6b2 | 2018-06-07 19:17:46 +0000 | [diff] [blame] | 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | /// |
| 9 | /// \file |
| 10 | /// This file describes a subset of C++ as a protobuf. It is used to |
Emmett Neyman | ba58c3a | 2018-08-15 23:05:48 +0000 | [diff] [blame] | 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. |
Vitaly Buka | 410a6b2 | 2018-06-07 19:17:46 +0000 | [diff] [blame] | 16 | /// |
| 17 | //===----------------------------------------------------------------------===// |
| 18 | |
Vitaly Buka | 410a6b2 | 2018-06-07 19:17:46 +0000 | [diff] [blame] | 19 | syntax = "proto2"; |
| 20 | |
Vitaly Buka | 410a6b2 | 2018-06-07 19:17:46 +0000 | [diff] [blame] | 21 | message Const { |
| 22 | required int32 val = 1; |
| 23 | } |
| 24 | |
Matt Morehouse | 3416773 | 2018-06-11 17:05:45 +0000 | [diff] [blame] | 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 | |
Vitaly Buka | 410a6b2 | 2018-06-07 19:17:46 +0000 | [diff] [blame] | 35 | message BinaryOp { |
| 36 | enum Op { |
| 37 | PLUS = 0; |
| 38 | MINUS = 1; |
| 39 | MUL = 2; |
Emmett Neyman | e5f4a9f | 2018-06-22 18:05:00 +0000 | [diff] [blame] | 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; |
Vitaly Buka | 410a6b2 | 2018-06-07 19:17:46 +0000 | [diff] [blame] | 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 { |
Matt Morehouse | 1dc1ff8 | 2018-06-08 00:33:35 +0000 | [diff] [blame] | 57 | Const cons = 1; |
| 58 | BinaryOp binop = 2; |
Matt Morehouse | 3416773 | 2018-06-11 17:05:45 +0000 | [diff] [blame] | 59 | VarRef varref = 3; |
Vitaly Buka | 410a6b2 | 2018-06-07 19:17:46 +0000 | [diff] [blame] | 60 | } |
| 61 | } |
| 62 | |
| 63 | message AssignmentStatement { |
Matt Morehouse | 3416773 | 2018-06-11 17:05:45 +0000 | [diff] [blame] | 64 | required VarRef varref = 1; |
Vitaly Buka | 410a6b2 | 2018-06-07 19:17:46 +0000 | [diff] [blame] | 65 | required Rvalue rvalue = 2; |
| 66 | } |
| 67 | |
Vitaly Buka | 410a6b2 | 2018-06-07 19:17:46 +0000 | [diff] [blame] | 68 | message Statement { |
Matt Morehouse | 3416773 | 2018-06-11 17:05:45 +0000 | [diff] [blame] | 69 | required AssignmentStatement assignment = 1; |
Vitaly Buka | 410a6b2 | 2018-06-07 19:17:46 +0000 | [diff] [blame] | 70 | } |
| 71 | |
| 72 | message StatementSeq { |
| 73 | repeated Statement statements = 1; |
| 74 | } |
| 75 | |
| 76 | message LoopFunction { |
Emmett Neyman | ba58c3a | 2018-08-15 23:05:48 +0000 | [diff] [blame] | 77 | optional StatementSeq inner_statements = 1; |
| 78 | required StatementSeq outer_statements = 2; |
Vitaly Buka | 410a6b2 | 2018-06-07 19:17:46 +0000 | [diff] [blame] | 79 | } |
| 80 | |
| 81 | package clang_fuzzer; |