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

Function encode_jal

crates/asm-to-binary/src/assembler/encode.rs:281–304  ·  view source on GitHub ↗
(
    rd: u8,
    target: &str,
    current_addr: u64,
    symbols: &super::symbol_table::SymbolTable,
)

Source from the content-addressed store, hash-verified

279 if !out.global_symbols.contains(g) {
280 out.global_symbols.push(g.clone());
281 }
282 }
283
284 Ok(out)
285}
286
287// --- Branch and jump encoding helpers ---
288
289// Layout symbols are section-relative; prefer the section-qualified entry so
290// same-named labels in other sections can't shadow the local one.
291fn resolve_section_local(
292 target: &str,
293 section_name: &str,
294 symbols: &super::symbol_table::SymbolTable,
295) -> Option<u64> {
296 symbols
297 .resolve(&format!("{target}@{section_name}"))
298 .or_else(|| symbols.resolve(target))
299}
300
301fn encode_branch(
302 kind: &BranchKind,
303 rs1: u8,
304 rs2: u8,
305 target: &str,
306 site_local: u64,
307 section_name: &str,

Callers 1

encodeFunction · 0.85

Calls 3

resolveMethod · 0.45
containsMethod · 0.45
encodeMethod · 0.45

Tested by

no test coverage detected