Where Online Learning is simpler!
The C and C++ Include Header Files
cat -n /usr/include/wabt/ir-util.h
1 /* 2 * Copyright 2016 WebAssembly Community Group participants 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef WABT_IR_UTIL_H_ 18 #define WABT_IR_UTIL_H_ 19 20 #include "wabt/common.h" 21 #include "wabt/ir.h" 22 23 namespace wabt { 24 25 struct Label { 26 Label(LabelType label_type, 27 const std::string& name, 28 const TypeVector& param_types, 29 const TypeVector& result_types) 30 : name(name), 31 label_type(label_type), 32 param_types(param_types), 33 result_types(result_types) {} 34 35 std::string name; 36 LabelType label_type; 37 TypeVector param_types; 38 TypeVector result_types; 39 }; 40 41 struct ModuleContext { 42 ModuleContext(const Module& module) : module(module) {} 43 44 Index GetLabelStackSize() const { return label_stack_.size(); } 45 const Label* GetLabel(const Var& var) const; 46 Index GetLabelArity(const Var& var) const; 47 void SetTopLabelType(LabelType label_type) { 48 label_stack_.back().label_type = label_type; 49 } 50 51 Index GetFuncParamCount(const Var& var) const; 52 Index GetFuncResultCount(const Var& var) const; 53 54 void BeginBlock(LabelType label_type, const Block& block); 55 void EndBlock(); 56 void BeginFunc(const Func& func); 57 void EndFunc(); 58 59 struct Arities { 60 Index nargs; 61 Index nreturns; 62 bool unreachable; 63 Arities(Index na, Index nr, bool ur = false) 64 : nargs(na), nreturns(nr), unreachable(ur) {} 65 }; 66 Arities GetExprArity(const Expr& expr) const; 67 68 const Module& module; 69 70 private: 71 const Func* current_func_ = nullptr; 72 std::vector<Label> label_stack_; 73 }; 74 75 } // namespace wabt 76 77 #endif /* WABT_IR_UTIL_H_ */