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:
@@ -753,6 +753,7 @@ impl<'a> FunctionBuilder<'a> {
|
||||
s.params.push(AbiParam::new(pointer_type));
|
||||
s.params.push(AbiParam::new(pointer_type));
|
||||
s.params.push(AbiParam::new(pointer_type));
|
||||
s.returns.push(AbiParam::new(pointer_type));
|
||||
self.import_signature(s)
|
||||
};
|
||||
|
||||
@@ -853,6 +854,7 @@ impl<'a> FunctionBuilder<'a> {
|
||||
s.params.push(AbiParam::new(pointer_type));
|
||||
s.params.push(AbiParam::new(types::I32));
|
||||
s.params.push(AbiParam::new(pointer_type));
|
||||
s.returns.push(AbiParam::new(pointer_type));
|
||||
self.import_signature(s)
|
||||
};
|
||||
|
||||
@@ -949,6 +951,7 @@ impl<'a> FunctionBuilder<'a> {
|
||||
s.params.push(AbiParam::new(pointer_type));
|
||||
s.params.push(AbiParam::new(pointer_type));
|
||||
s.params.push(AbiParam::new(pointer_type));
|
||||
s.returns.push(AbiParam::new(pointer_type));
|
||||
self.import_signature(s)
|
||||
};
|
||||
|
||||
@@ -1283,15 +1286,15 @@ mod tests {
|
||||
check(
|
||||
&func,
|
||||
"function %sample() -> i32 system_v {
|
||||
sig0 = (i64, i64, i64) system_v
|
||||
sig0 = (i64, i64, i64) -> i64 system_v
|
||||
fn0 = %Memcpy sig0
|
||||
|
||||
block0:
|
||||
v4 = iconst.i64 0
|
||||
v1 -> v4
|
||||
v3 = iconst.i64 0
|
||||
v1 -> v3
|
||||
v2 = iconst.i64 0
|
||||
v0 -> v2
|
||||
call fn0(v1, v0, v1) ; v1 = 0, v0 = 0, v1 = 0
|
||||
v0 -> v3
|
||||
v2 = call fn0(v1, v0, v1) ; v1 = 0, v0 = 0, v1 = 0
|
||||
return v1 ; v1 = 0
|
||||
}
|
||||
",
|
||||
@@ -1393,16 +1396,16 @@ block0:
|
||||
check(
|
||||
&func,
|
||||
"function %sample() -> i32 system_v {
|
||||
sig0 = (i64, i64, i64) system_v
|
||||
sig0 = (i64, i64, i64) -> i64 system_v
|
||||
fn0 = %Memcpy sig0
|
||||
|
||||
block0:
|
||||
v5 = iconst.i64 0
|
||||
v1 -> v5
|
||||
v4 = iconst.i64 0
|
||||
v1 -> v4
|
||||
v3 = iconst.i64 0
|
||||
v0 -> v3
|
||||
v0 -> v4
|
||||
v2 = iconst.i64 8192
|
||||
call fn0(v1, v0, v2) ; v1 = 0, v0 = 0, v2 = 8192
|
||||
v3 = call fn0(v1, v0, v2) ; v1 = 0, v0 = 0, v2 = 8192
|
||||
return v1 ; v1 = 0
|
||||
}
|
||||
",
|
||||
@@ -1478,16 +1481,16 @@ block0:
|
||||
check(
|
||||
&func,
|
||||
"function %sample() -> i32 system_v {
|
||||
sig0 = (i64, i32, i64) system_v
|
||||
sig0 = (i64, i32, i64) -> i64 system_v
|
||||
fn0 = %Memset sig0
|
||||
|
||||
block0:
|
||||
v4 = iconst.i64 0
|
||||
v0 -> v4
|
||||
v5 = iconst.i64 0
|
||||
v0 -> v5
|
||||
v1 = iconst.i8 1
|
||||
v2 = iconst.i64 8192
|
||||
v3 = uextend.i32 v1 ; v1 = 1
|
||||
call fn0(v0, v3, v2) ; v0 = 0, v2 = 8192
|
||||
v4 = call fn0(v0, v3, v2) ; v0 = 0, v2 = 8192
|
||||
return v0 ; v0 = 0
|
||||
}
|
||||
",
|
||||
|
||||
Reference in New Issue
Block a user