Allow both x86 backends to be included, selected with a "variant" flag. (#2514)

This PR adds a new `isa::lookup_variant()` that takes a `BackendVariant`
(`Legacy`, `MachInst` or `Any`), and exposes both x86 backends as
separate variants if both are compiled into the build.

This will allow some new use-cases that require both backends in the
same process: for example, differential fuzzing between old and new
backends, or perhaps allowing for dynamic feature-flag selection between
the backends.
This commit is contained in:
Chris Fallin
2020-12-16 07:56:04 -08:00
committed by GitHub
parent 245abc2bb2
commit e91987c43c
4 changed files with 67 additions and 32 deletions

View File

@@ -134,7 +134,7 @@ mod tests {
use crate::ir::{
types, AbiParam, ExternalName, InstBuilder, Signature, StackSlotData, StackSlotKind,
};
use crate::isa::{lookup, CallConv};
use crate::isa::{lookup_variant, BackendVariant, CallConv};
use crate::settings::{builder, Flags};
use crate::Context;
use gimli::write::Address;
@@ -143,7 +143,7 @@ mod tests {
#[test]
fn test_simple_func() {
let isa = lookup(triple!("x86_64"))
let isa = lookup_variant(triple!("x86_64"), BackendVariant::Legacy)
.expect("expect x86 ISA")
.finish(Flags::new(builder()));
@@ -185,7 +185,7 @@ mod tests {
#[test]
fn test_multi_return_func() {
let isa = lookup(triple!("x86_64"))
let isa = lookup_variant(triple!("x86_64"), BackendVariant::Legacy)
.expect("expect x86 ISA")
.finish(Flags::new(builder()));