MCPcopy Create free account
hub / github.com/LPC4/Full-Stack / keeps_pointer_stack_values_64_bit

Function keeps_pointer_stack_values_64_bit

tests/integration/rv64_codegen.rs:162–197  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

160 assert!(asm.contains("\tlw") || asm.contains("lw "), "expected i32 load to use lw, got:\n{asm}");
161}
162
163#[test]
164fn keeps_pointer_stack_values_64_bit() {
165 let mut program = IrProgram::new("test");
166 let mut func = IrFunction::new("ptrs", int32());
167
168 let mut entry = IrBlock::new("entry");
169 entry.push_instruction(IrInstruction::HeapAlloc {
170 dest: IrRegister::Named("heap".into()),
171 ty: int32(),
172 count: None,
173 });
174 entry.push_instruction(IrInstruction::Alloc {
175 dest: IrRegister::Named("holder".into()),
176 ty: IrType::Pointer(Box::new(int32())),
177 count: None,
178 });
179 entry.push_instruction(IrInstruction::Store {
180 ty: IrType::Pointer(Box::new(int32())),
181 value: IrValue::Register(IrRegister::Named("heap".into())),
182 ptr: IrRegister::Named("holder".into()),
183 offset: None,
184 });
185 entry.push_instruction(IrInstruction::Load {
186 dest: IrRegister::Named("alias".into()),
187 ty: IrType::Pointer(Box::new(int32())),
188 ptr: IrRegister::Named("holder".into()),
189 offset: None,
190 });
191 entry.set_terminator(IrTerminator::Return(Some(IrValue::Integer(0))));
192 func.push_block(entry);
193 program.push_function(func);
194
195 let asm = compile(&program);
196
197 assert!(asm.contains("\tsd") || asm.contains("sd "), "expected pointer store to use sd, got:\n{asm}");
198 assert!(asm.contains("\tld") || asm.contains("ld "), "expected pointer load to use ld, got:\n{asm}");
199}
200

Callers

nothing calls this directly

Calls 6

compileFunction · 0.85
push_blockMethod · 0.80
push_functionMethod · 0.80
int32Function · 0.70
push_instructionMethod · 0.45
set_terminatorMethod · 0.45

Tested by

no test coverage detected