Guest User

Untitled

a guest
Jun 7th, 2023
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rust 7.10 KB | None | 0 0
  1. pub mod ffi {
  2.     #[repr(C, align(8))]
  3.     pub struct DialectRegistry {
  4.         data: [u8; 72],
  5.         phantom: ::std::marker::PhantomData<::std::marker::PhantomPinned>,
  6.     }
  7.     extern "C" {
  8.         fn _ZN4mlir15DialectRegistryC1Ev(this: *mut DialectRegistry);
  9.     }
  10.     impl DialectRegistry {
  11.         pub unsafe fn new() -> Self {
  12.             let mut this = std::mem::MaybeUninit::<DialectRegistry>::uninit();
  13.             _ZN4mlir15DialectRegistryC1Ev(this.as_mut_ptr());
  14.             this.assume_init()
  15.         }
  16.     }
  17.     #[repr(C, align(8))]
  18.     pub struct MLIRContext {
  19.         data: [u8; 8],
  20.         phantom: ::std::marker::PhantomData<::std::marker::PhantomPinned>,
  21.     }
  22.     extern "C" {
  23.         fn _ZN4mlir11MLIRContextC1ENS0_9ThreadingE(
  24.             this: *mut MLIRContext,
  25.             threading: Threading,
  26.         );
  27.     }
  28.     impl MLIRContext {
  29.         pub unsafe fn new(threading: Threading) -> Self {
  30.             let mut this = std::mem::MaybeUninit::<MLIRContext>::uninit();
  31.             _ZN4mlir11MLIRContextC1ENS0_9ThreadingE(this.as_mut_ptr(), threading);
  32.             this.assume_init()
  33.         }
  34.     }
  35.     extern "C" {
  36.         fn _ZN4mlir11MLIRContext23isMultithreadingEnabledEv(
  37.             this: *mut MLIRContext,
  38.         ) -> bool;
  39.     }
  40.     impl MLIRContext {
  41.         pub unsafe fn isMultithreadingEnabled(&mut self) -> bool {
  42.             _ZN4mlir11MLIRContext23isMultithreadingEnabledEv(self as *mut _)
  43.         }
  44.     }
  45.     #[repr(i32)]
  46.     pub enum Threading {
  47.         DISABLED = 0,
  48.         ENABLED = 1,
  49.     }
  50.     #[repr(C, align(8))]
  51.     pub struct Builder {
  52.         data: [u8; 8],
  53.         phantom: ::std::marker::PhantomData<::std::marker::PhantomPinned>,
  54.     }
  55.     extern "C" {
  56.         fn _ZN4mlir7BuilderC1EPNS_11MLIRContextE(
  57.             this: *mut Builder,
  58.             context: *mut MLIRContext,
  59.         );
  60.     }
  61.     impl Builder {
  62.         pub unsafe fn new(context: *mut MLIRContext) -> Self {
  63.             let mut this = std::mem::MaybeUninit::<Builder>::uninit();
  64.             _ZN4mlir7BuilderC1EPNS_11MLIRContextE(this.as_mut_ptr(), context);
  65.             this.assume_init()
  66.         }
  67.     }
  68.     #[repr(C, align(8))]
  69.     pub struct Type {
  70.         data: [u8; 8],
  71.         phantom: ::std::marker::PhantomData<::std::marker::PhantomPinned>,
  72.     }
  73.     extern "C" {
  74.         fn _ZNK4mlir4Type7isIndexEv(this: *const Type) -> bool;
  75.     }
  76.     impl Type {
  77.         pub unsafe fn isIndex(&self) -> bool {
  78.             _ZNK4mlir4Type7isIndexEv(self as *const _)
  79.         }
  80.     }
  81.     extern "C" {
  82.         fn _ZNK4mlir4Type12isFloat8E5M2Ev(this: *const Type) -> bool;
  83.     }
  84.     impl Type {
  85.         pub unsafe fn isFloat8E5M2(&self) -> bool {
  86.             _ZNK4mlir4Type12isFloat8E5M2Ev(self as *const _)
  87.         }
  88.     }
  89.     extern "C" {
  90.         fn _ZNK4mlir4Type14isFloat8E4M3FNEv(this: *const Type) -> bool;
  91.     }
  92.     impl Type {
  93.         pub unsafe fn isFloat8E4M3FN(&self) -> bool {
  94.             _ZNK4mlir4Type14isFloat8E4M3FNEv(self as *const _)
  95.         }
  96.     }
  97.     extern "C" {
  98.         fn _ZNK4mlir4Type6isBF16Ev(this: *const Type) -> bool;
  99.     }
  100.     impl Type {
  101.         pub unsafe fn isBF16(&self) -> bool {
  102.             _ZNK4mlir4Type6isBF16Ev(self as *const _)
  103.         }
  104.     }
  105.     extern "C" {
  106.         fn _ZNK4mlir4Type5isF16Ev(this: *const Type) -> bool;
  107.     }
  108.     impl Type {
  109.         pub unsafe fn isF16(&self) -> bool {
  110.             _ZNK4mlir4Type5isF16Ev(self as *const _)
  111.         }
  112.     }
  113.     extern "C" {
  114.         fn _ZNK4mlir4Type5isF32Ev(this: *const Type) -> bool;
  115.     }
  116.     impl Type {
  117.         pub unsafe fn isF32(&self) -> bool {
  118.             _ZNK4mlir4Type5isF32Ev(self as *const _)
  119.         }
  120.     }
  121.     extern "C" {
  122.         fn _ZNK4mlir4Type5isF64Ev(this: *const Type) -> bool;
  123.     }
  124.     impl Type {
  125.         pub unsafe fn isF64(&self) -> bool {
  126.             _ZNK4mlir4Type5isF64Ev(self as *const _)
  127.         }
  128.     }
  129.     extern "C" {
  130.         fn _ZNK4mlir4Type5isF80Ev(this: *const Type) -> bool;
  131.     }
  132.     impl Type {
  133.         pub unsafe fn isF80(&self) -> bool {
  134.             _ZNK4mlir4Type5isF80Ev(self as *const _)
  135.         }
  136.     }
  137.     extern "C" {
  138.         fn _ZNK4mlir4Type6isF128Ev(this: *const Type) -> bool;
  139.     }
  140.     impl Type {
  141.         pub unsafe fn isF128(&self) -> bool {
  142.             _ZNK4mlir4Type6isF128Ev(self as *const _)
  143.         }
  144.     }
  145.     extern "C" {
  146.         fn _ZNK4mlir4Type9isIntegerEj(this: *const Type, width: u32) -> bool;
  147.     }
  148.     impl Type {
  149.         pub unsafe fn isInteger(&self, width: u32) -> bool {
  150.             _ZNK4mlir4Type9isIntegerEj(self as *const _, width)
  151.         }
  152.     }
  153.     extern "C" {
  154.         fn _ZNK4mlir4Type17isSignlessIntegerEv(this: *const Type) -> bool;
  155.     }
  156.     impl Type {
  157.         pub unsafe fn isSignlessInteger(&self) -> bool {
  158.             _ZNK4mlir4Type17isSignlessIntegerEv(self as *const _)
  159.         }
  160.     }
  161.     extern "C" {
  162.         fn _ZNK4mlir4Type17isUnsignedIntegerEv(this: *const Type) -> bool;
  163.     }
  164.     impl Type {
  165.         pub unsafe fn isUnsignedInteger(&self) -> bool {
  166.             _ZNK4mlir4Type17isUnsignedIntegerEv(self as *const _)
  167.         }
  168.     }
  169.     extern "C" {
  170.         fn _ZNK4mlir4Type21getIntOrFloatBitWidthEv(this: *const Type) -> u32;
  171.     }
  172.     impl Type {
  173.         pub unsafe fn getIntOrFloatBitWidth(&self) -> u32 {
  174.             _ZNK4mlir4Type21getIntOrFloatBitWidthEv(self as *const _)
  175.         }
  176.     }
  177.     extern "C" {
  178.         fn _ZNK4mlir4Type20isSignlessIntOrIndexEv(this: *const Type) -> bool;
  179.     }
  180.     impl Type {
  181.         pub unsafe fn isSignlessIntOrIndex(&self) -> bool {
  182.             _ZNK4mlir4Type20isSignlessIntOrIndexEv(self as *const _)
  183.         }
  184.     }
  185.     extern "C" {
  186.         fn _ZNK4mlir4Type27isSignlessIntOrIndexOrFloatEv(this: *const Type) -> bool;
  187.     }
  188.     impl Type {
  189.         pub unsafe fn isSignlessIntOrIndexOrFloat(&self) -> bool {
  190.             _ZNK4mlir4Type27isSignlessIntOrIndexOrFloatEv(self as *const _)
  191.         }
  192.     }
  193.     extern "C" {
  194.         fn _ZNK4mlir4Type20isSignlessIntOrFloatEv(this: *const Type) -> bool;
  195.     }
  196.     impl Type {
  197.         pub unsafe fn isSignlessIntOrFloat(&self) -> bool {
  198.             _ZNK4mlir4Type20isSignlessIntOrFloatEv(self as *const _)
  199.         }
  200.     }
  201.     extern "C" {
  202.         fn _ZNK4mlir4Type12isIntOrIndexEv(this: *const Type) -> bool;
  203.     }
  204.     impl Type {
  205.         pub unsafe fn isIntOrIndex(&self) -> bool {
  206.             _ZNK4mlir4Type12isIntOrIndexEv(self as *const _)
  207.         }
  208.     }
  209.     extern "C" {
  210.         fn _ZNK4mlir4Type12isIntOrFloatEv(this: *const Type) -> bool;
  211.     }
  212.     impl Type {
  213.         pub unsafe fn isIntOrFloat(&self) -> bool {
  214.             _ZNK4mlir4Type12isIntOrFloatEv(self as *const _)
  215.         }
  216.     }
  217.     extern "C" {
  218.         fn _ZNK4mlir4Type19isIntOrIndexOrFloatEv(this: *const Type) -> bool;
  219.     }
  220.     impl Type {
  221.         pub unsafe fn isIntOrIndexOrFloat(&self) -> bool {
  222.             _ZNK4mlir4Type19isIntOrIndexOrFloatEv(self as *const _)
  223.         }
  224.     }
  225.     extern "C" {
  226.         fn _ZNK4mlir4Type4dumpEv(this: *const Type);
  227.     }
  228.     impl Type {
  229.         pub unsafe fn dump(&self) {
  230.             _ZNK4mlir4Type4dumpEv(self as *const _)
  231.         }
  232.     }
  233. }
Advertisement
Add Comment
Please, Sign In to add comment