Add TargetIsa::as_any for downcasting to specific ISA implementations

This is necessary when we would like to check specific ISA flags, e.g.
This commit is contained in:
Andrew Brown
2020-05-21 11:54:19 -07:00
parent 9ba9fd0f64
commit 40f31375a5
5 changed files with 25 additions and 0 deletions

View File

@@ -10,6 +10,7 @@ use crate::settings::Flags;
#[cfg(feature = "testing_hooks")]
use crate::regalloc::RegDiversions;
use core::any::Any;
use std::borrow::Cow;
use std::fmt;
use target_lexicon::Triple;
@@ -127,4 +128,8 @@ impl TargetIsa for TargetIsaAdapter {
fn unsigned_sub_overflow_condition(&self) -> ir::condcodes::IntCC {
self.backend.unsigned_sub_overflow_condition()
}
fn as_any(&self) -> &dyn Any {
self as &dyn Any
}
}