Add a get_abi(TargetMachine) method instead of creating X86_64SystemV directly.

A new Arm64Linux ABI is added but it's an unedited copy of the X86_64SystemV one so far.

A bunch of cleanups from clippy. Use matches! more, don't pass &Box<dyn Abi>.
This commit is contained in:
Nick Lewycky
2020-10-20 14:46:45 -07:00
parent fa8e423404
commit e4981c4f66
6 changed files with 593 additions and 21 deletions

View File

@ -59,7 +59,7 @@ impl SymbolRegistry for ShortNames {
Ok(v) => v,
Err(_) => return None,
};
match ty.chars().nth(0).unwrap() {
match ty.chars().next().unwrap() {
'f' => Some(Symbol::LocalFunction(LocalFunctionIndex::from_u32(idx))),
's' => Some(Symbol::Section(SectionIndex::from_u32(idx))),
't' => Some(Symbol::FunctionCallTrampoline(SignatureIndex::from_u32(
@ -267,7 +267,7 @@ impl Compiler for LLVMCompiler {
self.config(),
memory_styles,
&table_styles,
&mut ShortNames {},
&ShortNames {},
)
},
)