MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / insert_bitcast

Function insert_bitcast

cranelift/fuzzgen/src/function_generator.rs:248–271  ·  view source on GitHub ↗
(
    fgen: &mut FunctionGenerator,
    builder: &mut FunctionBuilder,
    args: &[Type],
    rets: &[Type],
)

Source from the content-addressed store, hash-verified

246}
247
248fn insert_bitcast(
249 fgen: &mut FunctionGenerator,
250 builder: &mut FunctionBuilder,
251 args: &[Type],
252 rets: &[Type],
253) -> Result<()> {
254 let from_var = fgen.get_variable_of_type(args[0])?;
255 let from_val = builder.use_var(from_var);
256
257 let to_var = fgen.get_variable_of_type(rets[0])?;
258
259 // TODO: We can generate little/big endian flags here.
260 let mut memflags = MemFlagsData::new();
261
262 // When bitcasting between vectors of different lane counts, we need to
263 // specify the endianness.
264 if args[0].lane_count() != rets[0].lane_count() {
265 memflags.set_endianness(Endianness::Little);
266 }
267
268 let res = builder.ins().bitcast(rets[0], memflags, from_val);
269 builder.def_var(to_var, res);
270 Ok(())
271}
272
273fn insert_load_store(
274 fgen: &mut FunctionGenerator,

Callers 1

insert_load_storeFunction · 0.85

Calls 8

OkFunction · 0.85
get_variable_of_typeMethod · 0.80
set_endiannessMethod · 0.80
newFunction · 0.50
use_varMethod · 0.45
lane_countMethod · 0.45
insMethod · 0.45
def_varMethod · 0.45

Tested by

no test coverage detected