blob: 984212733914c144f3084b330b202516a084bbdd [file] [log] [blame]
Viet-Hoa Dobd4f6b92023-05-30 09:34:32 +01001/*
2 * Copyright (c) 2023 Arm Limited.
3 *
4 * SPDX-License-Identifier: MIT
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in all
14 * copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 * SOFTWARE.
23 */
24
Viet-Hoa Doce3c48c2023-07-03 13:44:43 +010025#ifndef CKW_PROTOTYPE_INCLUDE_CKW_OPERANDBASE_H
26#define CKW_PROTOTYPE_INCLUDE_CKW_OPERANDBASE_H
Viet-Hoa Dobd4f6b92023-05-30 09:34:32 +010027
Nikolaj Jensen5ff48022023-06-27 14:13:24 +010028#include "ckw/types/DataType.h"
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +010029
Viet-Hoa Dobd4f6b92023-05-30 09:34:32 +010030#include <string>
31
32namespace ckw
33{
34namespace prototype
35{
36class IGpuKernelWriter;
Nikolaj Jensenacea4072023-07-03 09:44:42 +010037
Viet-Hoa Dobd4f6b92023-05-30 09:34:32 +010038class Operand;
39} // namespace prototype
40
41/** The base class for all operands. */
42class OperandBase
43{
44public:
45 /** Constructor
46 *
47 * @param[in] name The name of the operand.
48 */
49 explicit OperandBase(const ::std::string &name);
50
51 /** Destructor */
52 virtual ~OperandBase();
53
54 /** (Internal use only) Create the implementation operand.
55 *
56 * @param[in] writer The implementation kernel writer.
57 */
58 virtual prototype::Operand create_impl_operand(prototype::IGpuKernelWriter *writer) const = 0;
59
60 /** Get the name of the operand. */
61 const ::std::string &name() const;
62
63 /** Set the name of the operand. */
64 OperandBase &name(const ::std::string &name);
65
66 /** Get the data type of the operand. */
67 virtual DataType data_type() const = 0;
68
69 /** Get whether the operand is compile-time constant. */
70 virtual bool is_constant() const = 0;
71
72private:
73 ::std::string _name;
74};
75
76} // namespace ckw
77
Viet-Hoa Doce3c48c2023-07-03 13:44:43 +010078#endif // CKW_PROTOTYPE_INCLUDE_CKW_OPERANDBASE_H