This is an archive of the discontinued LLVM Phabricator instance.

[SystemZ] Recognize .machine directive in parser.
ClosedPublic

Authored by jonpa on Sep 12 2021, 8:21 AM.

Details

Summary

The .machine directive can be used in assembly files to specify the ISA for the instructions following it.

Does such a directive need to be output again from the parser in case output is back into textual form (filetype=asm)? This is currently not done by the patch - I see that these are dropped after running GAS | objdump... (object format). I guess in that case either MCTargetStreamer is needed, or possibly some RawText emission..?

Diff Detail

Event Timeline

jonpa created this revision.Sep 12 2021, 8:21 AM
jonpa requested review of this revision.Sep 12 2021, 8:21 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 12 2021, 8:21 AM

Does such a directive need to be output again from the parser in case output is back into textual form (filetype=asm)? This is currently not done by the patch - I see that these are dropped after running GAS | objdump... (object format). I guess in that case either MCTargetStreamer is needed, or possibly some RawText emission..?

I think for consistency the .machine should be output again. It's probably best to add a MCTargetStreamer now, sooner or later we'll probably need one anyway. (This may also help with implementing EXRL templates via the constant pool mechanism as discussed elsewhere ...)

jonpa updated this revision to Diff 372288.Sep 13 2021, 10:10 AM

SystemZTargetStreamer added with derived and registered SystemZTargetAsmStreamer and SystemZTargetELFStreamer classes. The object TargetStreamer does not output anything in emitMachine(), which I don't think it should, or?

uweigand accepted this revision.Sep 14 2021, 12:29 AM

SystemZTargetStreamer added with derived and registered SystemZTargetAsmStreamer and SystemZTargetELFStreamer classes. The object TargetStreamer does not output anything in emitMachine(), which I don't think it should, or?

Yes, I agree this is correct . Patch LGTM.

This revision is now accepted and ready to land.Sep 14 2021, 12:29 AM
This revision was landed with ongoing or failed builds.Sep 17 2021, 3:08 AM
This revision was automatically updated to reflect the committed changes.
jonpa added a comment.Sep 17 2021, 3:14 AM

(Committed with some clang-tidy suggested reformatting applied as well)