1 // Copyright 2020 The Tint Authors.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //     http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef SRC_AST_TYPE_I32_TYPE_H_
16 #define SRC_AST_TYPE_I32_TYPE_H_
17 
18 #include <string>
19 
20 #include "src/ast/type/type.h"
21 
22 namespace tint {
23 namespace ast {
24 namespace type {
25 
26 /// A signed int 32 type.
27 class I32Type : public Type {
28  public:
29   /// Constructor
30   I32Type();
31   /// Move constructor
32   I32Type(I32Type&&) = default;
33   ~I32Type() override;
34 
35   /// @returns true if the type is an i32 type
36   bool IsI32() const override;
37 
38   /// @returns the name for this type
39   std::string type_name() const override;
40 
41   /// @param mem_layout type of memory layout to use in calculation.
42   /// @returns minimum size required for this type, in bytes.
43   ///          0 for non-host shareable types.
44   uint64_t MinBufferBindingSize(MemoryLayout mem_layout) const override;
45 
46   /// @param mem_layout type of memory layout to use in calculation.
47   /// @returns base alignment for the type, in bytes.
48   ///          0 for non-host shareable types.
49   uint64_t BaseAlignment(MemoryLayout mem_layout) const override;
50 };
51 
52 }  // namespace type
53 }  // namespace ast
54 }  // namespace tint
55 
56 #endif  // SRC_AST_TYPE_I32_TYPE_H_
57