I can use llc to compile my IR module to amdgcn with some non-zero output. However, if try to write the output (assembly or object) to a string (via buffer_ostream) the resulting string has always zero length. Here the code changes I do:
if \(Target\->addPassesToEmitFile\(PM, \*OS, DwoOut ? &DwoOut\->os\(\) : nullptr, FileType, NoVerify, MMIWP\)\)
Now, with this tiny change I was hoping to write to a string instead of the output stream defined by the command line parameters:
if (Target->addPassesToEmitFile(PM, pstream,
DwoOut ? &DwoOut->os() : nullptr,
FileType, NoVerify, MMIWP))
later, e.g., after PM.run(*M), I check the string for content with
WithColor::warning(errs(), argv) << "with flush, output size: " << outStr.length() << "\n";
But this always yields "with flush, output size: 0"
I tried to flush the raw_string_ostream before using the string, same result.
The used command line was
llc -march=amdgcn -mcpu=gfx906 < module.ll
Anyone see what's wrong with the code?