//MACRO Exit Stack= !"" //-------------------------------------------------------------------------------------------------- // // @ CopyRight Roberti & Parau Enterprises, Inc. 2021-2023 // // This work is licensed under the Creative Commons Attribution-NoDerivatives 4.0 International License. // To view a copy of this license, visit http://creativecommons.org/licenses/by-nd/4.0/ // or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA. // //-------------------------------------------------------------------------------------------------- // // // Check label // if (Label !== "") DVASM.formatLine(Label, "BYTE", "0[0]", ""); // // CHeck if stack specified // if (Stack === "") { DVASM.formatLine("", "JALR", "0, 0[ra]", "// Return to caller"); return; } // // Get right load/store MIs and word length // eval(DVASM.getEnv()[4]); var restoreOpCode= "L" + abiWID; // // Check if exit from leaf entry // if (Stack === "") return DVASM.formatLine("", "JALR", "0, 0[ra]", "// Return to caller"); var stackLabel= Stack + "."; // // Restore registers // var lbl= stackLabel + "s"; for (var i= 0; i < (abiNoRegs <= 16 ? 2 : 12); i++) DVASM.formatLine("", restoreOpCode, "s" + i + "," + lbl + i + ", Cond=YES", ""); // // Restore float registers if any // if (abiNoFRegs > 0) { lbl= stackLabel + "fs"; var restoreFloatOpCode= ("FL" + abiFWID); for (var i= 0; i < 12; i++) DVASM.formatLine("", restoreFloatOpCode, "fs" + i + "," + lbl + i + ", Cond=YES", ""); } // // Standard return // DVASM.formatLine("", restoreOpCode, "ra, " + stackLabel + "ra", "// Save ra"); DVASM.formatLine("", "ADDI", "sp, " + stackLabel + "StackLen", "// Set sp to point to caller stack frame"); DVASM.formatLine("", "JALR", "0, 0[ra]", "// Return to caller");