Add a legalize_signature method to TargetIsa.

This entry point will be used for controlling ABI conventions when
legalizing.

Provide an empty implementation for RISC-V and let the other ISAs crash
in legalization.

This is just the scaffolding. We still need to:

- Rewrite the entry block arguments to match the legalized signature.
- Rewrite call and return instructions.
- Implement the legalize_signature() function for all ISAs.
- Add shared generic types to help with the legalize_signature()
  functions.
This commit is contained in:
Jakob Stoklund Olesen
2017-03-01 11:53:52 -08:00
parent cb3e503f07
commit 408395db25
5 changed files with 54 additions and 7 deletions

View File

@@ -1,6 +1,7 @@
//! RISC-V Instruction Set Architecture.
pub mod settings;
mod abi;
mod enc_tables;
mod registers;
@@ -8,7 +9,7 @@ use super::super::settings as shared_settings;
use isa::enc_tables::{self as shared_enc_tables, lookup_enclist, general_encoding};
use isa::Builder as IsaBuilder;
use isa::{TargetIsa, RegInfo, Encoding, Legalize, RecipeConstraints};
use ir::{InstructionData, DataFlowGraph};
use ir::{InstructionData, DataFlowGraph, Signature};
#[allow(dead_code)]
struct Isa {
@@ -74,6 +75,11 @@ impl TargetIsa for Isa {
fn recipe_constraints(&self) -> &'static [RecipeConstraints] {
&enc_tables::RECIPE_CONSTRAINTS
}
fn legalize_signature(&self, sig: &mut Signature) {
// We can pass in `self.isa_flags` too, if we need it.
abi::legalize_signature(sig, &self.shared_flags)
}
}
#[cfg(test)]