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 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | /// |
| 10 | /// \file |
| 11 | /// 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] | 12 | /// more easily find interesting inputs for fuzzing LLVM's vectorizer. |
| 13 | /// This subset differs from the one defined in cxx_proto.proto by eliminating |
| 14 | /// while loops and conditionals. The goal is that the C++ code generated will |
| 15 | /// be more likely to stress the LLVM loop vectorizer. The code generated will |
| 16 | /// contain either a single loop or two nested loops. |
Vitaly Buka | 410a6b2 | 2018-06-07 19:17:46 +0000 | [diff] [blame] | 17 | /// |
| 18 | //===----------------------------------------------------------------------===// |
| 19 | |
Vitaly Buka | 410a6b2 | 2018-06-07 19:17:46 +0000 | [diff] [blame] | 20 | syntax = "proto2"; |
| 21 | |
Vitaly Buka | 410a6b2 | 2018-06-07 19:17:46 +0000 | [diff] [blame] | 22 | message Const { |
| 23 | required int32 val = 1; |
| 24 | } |
| 25 | |
Matt Morehouse | 3416773 | 2018-06-11 17:05:45 +0000 | [diff] [blame] | 26 | message VarRef { |
| 27 | // Add an enum for each array in function signature |
| 28 | enum Arr { |
| 29 | ARR_A = 0; |
| 30 | ARR_B = 1; |
| 31 | ARR_C = 2; |
| 32 | }; |
| 33 | required Arr arr = 1; |
| 34 | } |
| 35 | |
Vitaly Buka | 410a6b2 | 2018-06-07 19:17:46 +0000 | [diff] [blame] | 36 | message BinaryOp { |
| 37 | enum Op { |
| 38 | PLUS = 0; |
| 39 | MINUS = 1; |
| 40 | MUL = 2; |
Emmett Neyman | e5f4a9f | 2018-06-22 18:05:00 +0000 | [diff] [blame] | 41 | XOR = 3; |
| 42 | AND = 4; |
| 43 | OR = 5; |
| 44 | EQ = 6; |
| 45 | NE = 7; |
| 46 | LE = 8; |
| 47 | GE = 9; |
| 48 | LT = 10; |
| 49 | GT = 11; |
Vitaly Buka | 410a6b2 | 2018-06-07 19:17:46 +0000 | [diff] [blame] | 50 | }; |
| 51 | required Op op = 1; |
| 52 | required Rvalue left = 2; |
| 53 | required Rvalue right = 3; |
| 54 | } |
| 55 | |
| 56 | message Rvalue { |
| 57 | oneof rvalue_oneof { |
Matt Morehouse | 1dc1ff8 | 2018-06-08 00:33:35 +0000 | [diff] [blame] | 58 | Const cons = 1; |
| 59 | BinaryOp binop = 2; |
Matt Morehouse | 3416773 | 2018-06-11 17:05:45 +0000 | [diff] [blame] | 60 | VarRef varref = 3; |
Vitaly Buka | 410a6b2 | 2018-06-07 19:17:46 +0000 | [diff] [blame] | 61 | } |
| 62 | } |
| 63 | |
| 64 | message AssignmentStatement { |
Matt Morehouse | 3416773 | 2018-06-11 17:05:45 +0000 | [diff] [blame] | 65 | required VarRef varref = 1; |
Vitaly Buka | 410a6b2 | 2018-06-07 19:17:46 +0000 | [diff] [blame] | 66 | required Rvalue rvalue = 2; |
| 67 | } |
| 68 | |
Vitaly Buka | 410a6b2 | 2018-06-07 19:17:46 +0000 | [diff] [blame] | 69 | message Statement { |
Matt Morehouse | 3416773 | 2018-06-11 17:05:45 +0000 | [diff] [blame] | 70 | required AssignmentStatement assignment = 1; |
Vitaly Buka | 410a6b2 | 2018-06-07 19:17:46 +0000 | [diff] [blame] | 71 | } |
| 72 | |
| 73 | message StatementSeq { |
| 74 | repeated Statement statements = 1; |
| 75 | } |
| 76 | |
| 77 | message LoopFunction { |
Emmett Neyman | ba58c3a | 2018-08-15 23:05:48 +0000 | [diff] [blame] | 78 | optional StatementSeq inner_statements = 1; |
| 79 | required StatementSeq outer_statements = 2; |
Vitaly Buka | 410a6b2 | 2018-06-07 19:17:46 +0000 | [diff] [blame] | 80 | } |
| 81 | |
| 82 | package clang_fuzzer; |