You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My own hobby ISA has a call instruction double as a return instruction. Therefore, if you put the function exit right before the entry label, the link register ends up being set to the function you just called, making it cheaper (in code size, by one byte) to call it again later. Unfortunately, actually branching to this return instruction from within the function body can't be done with a local label, because it's "outside" the function.
;; printCStringFromData2;; Uses r0-r1;; Precondition: r0 is the address of a C string in data2;; Postcondition: r0 is the address just after the NUL terminatorprintCStringFromData2_done: CABL ; Call ABsolute address in Link registerprintCStringFromData2: ; this is the entry point.loop: LD2U r0 ; load *r0++ BEZI printCStringFromData2_done ; exit the loop on NUL PRNT ; print a single character JOFI .loop
I could of course make a workaround like having the label be at the CABL instruction and having the reference increment past it (probably with an expression), or having the branch to the function epilogue do some extra math, but what I'd really like is a way to say "this local label is associated with the next top-level label", whether that's a different spelling of the label (.,done, ~done, whatever) or a separate directive before the label (#section, whatever). That said, I totally get why nobody's done this yet…!
The text was updated successfully, but these errors were encountered:
My own hobby ISA has a call instruction double as a return instruction. Therefore, if you put the function exit right before the entry label, the link register ends up being set to the function you just called, making it cheaper (in code size, by one byte) to call it again later. Unfortunately, actually branching to this return instruction from within the function body can't be done with a local label, because it's "outside" the function.
I could of course make a workaround like having the label be at the CABL instruction and having the reference increment past it (probably with an expression), or having the branch to the function epilogue do some extra math, but what I'd really like is a way to say "this local label is associated with the next top-level label", whether that's a different spelling of the label (
.,done
,~done
, whatever) or a separate directive before the label (#section
, whatever). That said, I totally get why nobody's done this yet…!The text was updated successfully, but these errors were encountered: