Support .option rvc and norvc to enable/disable C extension within file.
Kito, can you add an instruction before the first .option rvc to make sure the default behavior is unaltered:
This should be pure virtual method that you only implement in your RISCVTsargetELFstreamer and your RISCVASMstreamer. Making it virtual causes extra entries for your vtable.
Look at MCStreamer.h line 62
- Fix coding style issue.
- Add more instructions to testcase.
- Make emitDirectiveOptionRVC and emitDirectiveOptionNoRVC to pure virtual function.
- Return nullptr rather than RISCVTargetStreamer in createRISCVObjectTargetStreamer, because we have pure virtual function in RISCVTargetStreamer now.
There's a corner case we're probably going to encounter here vs gcc.
In GCC, .option rvc or .option norvc in inline asm will have the effect of enabling/disabling instruction compression from that point onwards. I assume it won't have that effect with LLVM unless you use -save-temps. It might be that we decide this use of inline asm isn't supported by LLVM and people should use appropriate function or module attributes instead. Either way, a test which demonstrates the behaviour would be worthwhile.