tvm_tirx/ir/global_info.rs
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19// The generated `new` of a field-less base needs no `Default`.
20#![allow(clippy::new_without_default)]
21
22//! Module-level information. A [`GlobalInfo`] is information an [`IRModule`](super::IRModule)
23//! holds besides its functions, kept by name in `global_infos`.
24
25// tvm-ffi-stubgen(file): mod(missing_docs = allow)
26// `no_new` generates no allocator for the abstract base: a value is one of its subtypes.
27// tvm-ffi-stubgen(object): ir.GlobalInfo(no_new)
28
29// tvm-ffi-stubgen(begin): import-section
30use tvm_ffi::Object;
31use tvm_ffi::ObjectArc;
32// tvm-ffi-stubgen(end)
33
34/// The base of the module-level information an [`IRModule`](super::IRModule) keeps by name in
35/// `global_infos`.
36// tvm-ffi-stubgen(begin): object/ir.GlobalInfo
37#[allow(missing_docs)]
38#[repr(C)]
39#[derive(tvm_ffi::derive::ObjectRef, Clone)]
40pub struct GlobalInfo {
41 data_: ObjectArc<GlobalInfoObj>,
42}
43
44/// The object behind [`GlobalInfo`].
45// Complete: reflected fields fill [24, 24) exactly.
46#[allow(missing_docs)]
47#[repr(C)]
48#[derive(tvm_ffi::derive::Object)]
49#[object(type_key = "ir.GlobalInfo", immutable, rs_parent)]
50pub struct GlobalInfoObj {
51 base_: Object,
52}
53
54const _: () = {
55 assert!(::core::mem::size_of::<GlobalInfoObj>() == 24);
56 assert!(::core::mem::align_of::<GlobalInfoObj>() == 8);
57};
58
59#[allow(missing_docs)]
60impl GlobalInfoObj {
61 pub fn new() -> Self {
62 let base_ = Object::new();
63 Self { base_ }
64 }
65}
66// tvm-ffi-stubgen(end)