Tatiana Shpeisman | c96b587 | 2018-06-28 17:02:32 -0700 | [diff] [blame^] | 1 | //===- MLFunction.h - MLIR MLFunction Class -------------------*- C++ -*-===// |
| 2 | // |
| 3 | // Copyright 2019 The MLIR Authors. |
| 4 | // |
| 5 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | // you may not use this file except in compliance with the License. |
| 7 | // You may obtain a copy of the License at |
| 8 | // |
| 9 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | // |
| 11 | // Unless required by applicable law or agreed to in writing, software |
| 12 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | // See the License for the specific language governing permissions and |
| 15 | // limitations under the License. |
| 16 | // ============================================================================= |
| 17 | // |
| 18 | // This file defines MLFunction class |
| 19 | // |
| 20 | //===----------------------------------------------------------------------===// |
| 21 | |
| 22 | #ifndef MLIR_IR_MLFUNCTION_H_ |
| 23 | #define MLIR_IR_MLFUNCTION_H_ |
| 24 | |
| 25 | #include "mlir/IR/Function.h" |
| 26 | #include "mlir/IR/MLStatements.h" |
| 27 | #include <vector> |
| 28 | |
| 29 | namespace mlir { |
| 30 | |
| 31 | // MLFunction is defined as a sequence of statements that may |
| 32 | // include nested affine for loops, conditionals and instructions. |
| 33 | class MLFunction : public Function { |
| 34 | public: |
| 35 | MLFunction(StringRef name, FunctionType *type); |
| 36 | |
| 37 | // FIXME: wrong representation and API, leaks memory etc |
| 38 | std::vector<MLStatement*> stmtList; |
| 39 | |
| 40 | // TODO: add function arguments and return values once |
| 41 | // SSA values are implemented |
| 42 | |
| 43 | // Methods for support type inquiry through isa, cast, and dyn_cast |
| 44 | static bool classof(const Function *func) { |
| 45 | return func->getKind() == Kind::MLFunc; |
| 46 | } |
| 47 | |
| 48 | void print(raw_ostream &os) const; |
| 49 | }; |
| 50 | |
| 51 | } // end namespace mlir |
| 52 | |
| 53 | #endif // MLIR_IR_MLFUNCTION_H_ |