Commit 050a3696 authored by Jason Hiser's avatar Jason Hiser 🚜
Browse files

fixed comments about odd constant

parent b271322f
Pipeline #2708 passed with stages
in 6 minutes and 53 seconds
......@@ -130,17 +130,16 @@ void InitStack_t::initStack(Function_t* f)
// Now, do the dirty work of inserting new assembly to initialize the stack.
// Insert these instructions at the start of the function (to initialize the stack frame before the function runs)
// Assume: flags and scratch_reg are dead at function entry.
// Assume: flags are dead at function entry.
// Future work: Verify this is true using dead register list.
// Note: we initialize 128 bytes passed the end of the frame to make sure the "red zone" is initialized too
// Future work: Red zone on i686 is 4k, may need to adjust or reconsider how this works. Analyze function for red zone usage?
// Note: we spill a scratch register into the red zone at 120 bytes passed the end of the frame
auto tmp=entry;
insertAssemblyBefore (tmp, string()+"mov ["+sp_reg+"+"+to_string(-f->getStackFrameSize()-128)+"], "+scratch_reg);
insertAssemblyBefore (tmp, string()+"mov ["+sp_reg+"+"+to_string(-f->getStackFrameSize()-120)+"], "+scratch_reg);
tmp = insertAssemblyAfter (tmp, string()+"mov "+scratch_reg+", -" + to_string(num_locs));
const auto L1 = tmp = insertAssemblyAfter (tmp, string()+"mov dword ["+sp_reg+"+"+scratch_reg+"*4-4], " + to_string(m_init_value));
tmp = insertAssemblyAfter (tmp, string()+"inc "+scratch_reg);
tmp = insertAssemblyAfter (tmp, string()+"jnz 0", L1); // jnz to L1
tmp = insertAssemblyAfter (tmp, string()+"mov "+scratch_reg+", ["+sp_reg+"+"+to_string(-f->getStackFrameSize()-128)+"] ");
tmp = insertAssemblyAfter (tmp, string()+"mov "+scratch_reg+", ["+sp_reg+"+"+to_string(-f->getStackFrameSize()-120)+"] ");
// bump stats
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment