This is an archive of the discontinued LLVM Phabricator instance.

X86: Implement null target streamer
ClosedPublic

Authored by arsenm on Oct 28 2022, 2:10 PM.

Details

Summary

There should no need for null checks in the AsmPrinter

Diff Detail

Event Timeline

arsenm created this revision.Oct 28 2022, 2:10 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 28 2022, 2:10 PM
arsenm requested review of this revision.Oct 28 2022, 2:10 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 28 2022, 2:10 PM
Herald added a subscriber: wdng. · View Herald Transcript
MaskRay added a comment.EditedOct 28 2022, 2:22 PM

Add a test which this may fix. If MCTargetStreamer is not used (e.g. always guarded by a if-nullptr check), createX86NullTargetStreamer is not needed.

arsenm updated this revision to Diff 471665.Oct 28 2022, 3:11 PM

Add test

MaskRay added inline comments.Oct 28 2022, 3:15 PM
clang/test/Misc/x86-emit-codegen-only.c
5 ↗(On Diff #471665)

This should use a llvm/test/MC or llvm/test/CodeGen test.

RKSimon added inline comments.Oct 29 2022, 3:40 AM
llvm/lib/Target/X86/MCTargetDesc/X86TargetStreamer.h
41

Why not create a X86TargetNullStreamer class and keep X86TargetStreamer as it is?

arsenm updated this revision to Diff 471755.Oct 29 2022, 9:11 AM
arsenm marked an inline comment as done.

Move test

arsenm added inline comments.Oct 29 2022, 9:11 AM
llvm/lib/Target/X86/MCTargetDesc/X86TargetStreamer.h
41

That's a lot of extra boilerplate to do nothing

RKSimon added inline comments.Oct 31 2022, 3:43 AM
llvm/lib/Target/X86/MCTargetDesc/X86TargetStreamer.h
41

OK - I see WebAssemblyTargetNullStreamer does override but I don't think its vital.

MaskRay accepted this revision.Oct 31 2022, 10:46 AM
This revision is now accepted and ready to land.Oct 31 2022, 10:46 AM