Implement representation options to smir

This commit is contained in:
Shoyu Vanilla
2025-06-03 13:38:00 +09:00
parent 2fc3deed9f
commit dabed3372c
6 changed files with 132 additions and 6 deletions

View File

@@ -6,7 +6,7 @@
use std::cell::Cell;
use rustc_smir::context::SmirCtxt;
use stable_mir::abi::{FnAbi, Layout, LayoutShape};
use stable_mir::abi::{FnAbi, Layout, LayoutShape, ReprOptions};
use stable_mir::crate_def::Attribute;
use stable_mir::mir::alloc::{AllocId, GlobalAlloc};
use stable_mir::mir::mono::{Instance, InstanceDef, StaticDef};
@@ -200,6 +200,11 @@ impl<'tcx> SmirInterface<'tcx> {
self.cx.adt_is_cstr(def)
}
/// Returns the representation options for this ADT
pub(crate) fn adt_repr(&self, def: AdtDef) -> ReprOptions {
self.cx.adt_repr(def)
}
/// Retrieve the function signature for the given generic arguments.
pub(crate) fn fn_sig(&self, def: FnDef, args: &GenericArgs) -> PolyFnSig {
self.cx.fn_sig(def, args)