How To Optimize The Generated Assembly

Optimize the generated assembly before bytecode generation

OwlSL doesn't currently optimize the generated assembly, but you can add your own optimizer in the middle of the compilation. Instead of calling cwl.compile() you can call cwl.compile_sco (). That will leave the generated text version of the assembly code inside the member variable cwl.assembly. This member variable is of type owlsl::text. If you want to get the ascii version of the assembly code call cwl.assembly.string() which returns an std::string. For the wide char version call cwl.assembly.wstring(). You can take that assembly code, optimize it as you wish and when you're done store the optimized source code back to that same member variable (cwl.assembly=your_std_w/string) and call cwl.sco.append(cwl.assembly) and cwl.sco.compile().