Handle signature() for more libcalls (#6174)

* Handle signature() for more libcalls

This is necessary to be able to call them in the interpreter. All the
remaining libcalls which signature() doesn't handle are never used in
clif ir. Only in code compiled by a backend.

* Fix libcall declarations in cranelift-frontend

* Add function signatures

* Use correct pointer type instead of I64
This commit is contained in:
bjorn3
2023-04-11 18:50:41 +02:00
committed by GitHub
parent 52440f0fc8
commit 0478ead3f8
6 changed files with 57 additions and 30 deletions

View File

@@ -5,8 +5,8 @@ use crate::frame::Frame;
use crate::interpreter::LibCallHandler;
use cranelift_codegen::data_value::DataValue;
use cranelift_codegen::ir::{
ExternalName, FuncRef, Function, GlobalValue, LibCall, MemFlags, Signature, StackSlot, Type,
Value,
types, ExternalName, FuncRef, Function, GlobalValue, LibCall, MemFlags, Signature, StackSlot,
Type, Value,
};
use cranelift_codegen::isa::CallConv;
use smallvec::SmallVec;
@@ -96,7 +96,8 @@ impl<'a> InterpreterFunctionRef<'a> {
match self {
InterpreterFunctionRef::Function(f) => f.stencil.signature.clone(),
// CallConv here is sort of irrelevant, since we don't use it for anything
InterpreterFunctionRef::LibCall(lc) => lc.signature(CallConv::SystemV),
// FIXME handle non-64bit systems
InterpreterFunctionRef::LibCall(lc) => lc.signature(CallConv::SystemV, types::I64),
}
}
}