Method: Voodoo::AMD64NasmGenerator#end_function
- Defined in:
- lib/voodoo/generators/amd64_nasm_generator.rb
#end_function ⇒ Object
Ends a function body.
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 |
# File 'lib/voodoo/generators/amd64_nasm_generator.rb', line 181 def end_function label @function_end_label # Restore saved registers @saved_registers.each_with_index do |register,i| ref = offset_reference saved_local_offset(i) emit "mov #{register}, #{ref}\n" end # Destroy frame. emit "leave\n" # Return. emit "ret\n" if @environment == @top_level raise "Cannot end function when not in a function" else @environment = @top_level end end |