-
Notifications
You must be signed in to change notification settings - Fork 15.4k
[ARM] Move MCStreamer::emitThumbFunc to ARMTargetStreamer #126199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -168,6 +168,7 @@ class ARMTargetStreamer : public MCTargetStreamer { | |
|
|
||
| virtual void annotateTLSDescriptorSequence(const MCSymbolRefExpr *SRE); | ||
|
|
||
| virtual void emitThumbFunc(MCSymbol *Symbol); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could we preserve the comment, minus the ARM only part |
||
| virtual void emitThumbSet(MCSymbol *Symbol, const MCExpr *Value); | ||
|
|
||
| void emitConstantPools() override; | ||
|
|
@@ -501,10 +502,6 @@ class MCStreamer { | |
| const Triple *DarwinTargetVariantTriple, | ||
| const VersionTuple &DarwinTargetVariantSDKVersion); | ||
|
|
||
| /// Note in the output that the specified \p Func is a Thumb mode | ||
| /// function (ARM target only). | ||
| virtual void emitThumbFunc(MCSymbol *Func); | ||
|
|
||
| /// Emit an assignment of \p Value to \p Symbol. | ||
| /// | ||
| /// This corresponds to an assembler statement such as: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -100,6 +100,7 @@ class ARMTargetAsmStreamer : public ARMTargetStreamer { | |
| void finishAttributeSection() override; | ||
|
|
||
| void annotateTLSDescriptorSequence(const MCSymbolRefExpr *SRE) override; | ||
| void emitThumbFunc(MCSymbol *Symbol) override; | ||
| void emitThumbSet(MCSymbol *Symbol, const MCExpr *Value) override; | ||
|
|
||
| void emitARMWinCFIAllocStack(unsigned Size, bool Wide) override; | ||
|
|
@@ -260,6 +261,19 @@ void ARMTargetAsmStreamer::annotateTLSDescriptorSequence( | |
| OS << "\t.tlsdescseq\t" << S->getSymbol().getName() << "\n"; | ||
| } | ||
|
|
||
| void ARMTargetAsmStreamer::emitThumbFunc(MCSymbol *Symbol) { | ||
| const MCAsmInfo *MAI = Streamer.getContext().getAsmInfo(); | ||
| // This needs to emit to a temporary string to get properly quoted | ||
|
||
| // MCSymbols when they have spaces in them. | ||
| OS << "\t.thumb_func"; | ||
| // Only Mach-O hasSubsectionsViaSymbols() | ||
| if (MAI->hasSubsectionsViaSymbols()) { | ||
| OS << '\t'; | ||
| Symbol->print(OS, MAI); | ||
| } | ||
| OS << '\n'; | ||
| } | ||
|
|
||
| void ARMTargetAsmStreamer::emitThumbSet(MCSymbol *Symbol, const MCExpr *Value) { | ||
| const MCAsmInfo *MAI = Streamer.getContext().getAsmInfo(); | ||
|
|
||
|
|
@@ -422,6 +436,7 @@ class ARMTargetELFStreamer : public ARMTargetStreamer { | |
| void emitLabel(MCSymbol *Symbol) override; | ||
|
|
||
| void annotateTLSDescriptorSequence(const MCSymbolRefExpr *SRE) override; | ||
| void emitThumbFunc(MCSymbol *Symbol) override; | ||
| void emitThumbSet(MCSymbol *Symbol, const MCExpr *Value) override; | ||
|
|
||
| // Reset state between object emissions | ||
|
|
@@ -686,11 +701,6 @@ class ARMELFStreamer : public MCELFStreamer { | |
| Symbol->setBinding(ELF::STB_LOCAL); | ||
| } | ||
|
|
||
| void emitThumbFunc(MCSymbol *Func) override { | ||
| getAssembler().setIsThumbFunc(Func); | ||
| emitSymbolAttribute(Func, MCSA_ELF_TypeFunction); | ||
| } | ||
|
|
||
| // Helper functions for ARM exception handling directives | ||
| void EHReset(); | ||
|
|
||
|
|
@@ -1089,14 +1099,19 @@ void ARMTargetELFStreamer::emitLabel(MCSymbol *Symbol) { | |
| Streamer.getAssembler().registerSymbol(*Symbol); | ||
| unsigned Type = cast<MCSymbolELF>(Symbol)->getType(); | ||
| if (Type == ELF::STT_FUNC || Type == ELF::STT_GNU_IFUNC) | ||
| Streamer.emitThumbFunc(Symbol); | ||
| emitThumbFunc(Symbol); | ||
| } | ||
|
|
||
| void ARMTargetELFStreamer::annotateTLSDescriptorSequence( | ||
| const MCSymbolRefExpr *S) { | ||
| getStreamer().EmitFixup(S, FK_Data_4); | ||
| } | ||
|
|
||
| void ARMTargetELFStreamer::emitThumbFunc(MCSymbol *Func) { | ||
| getStreamer().getAssembler().setIsThumbFunc(Func); | ||
| getStreamer().emitSymbolAttribute(Func, MCSA_ELF_TypeFunction); | ||
| } | ||
|
|
||
| void ARMTargetELFStreamer::emitThumbSet(MCSymbol *Symbol, const MCExpr *Value) { | ||
| if (const MCSymbolRefExpr *SRE = dyn_cast<MCSymbolRefExpr>(Value)) { | ||
| const MCSymbol &Sym = SRE->getSymbol(); | ||
|
|
@@ -1106,7 +1121,7 @@ void ARMTargetELFStreamer::emitThumbSet(MCSymbol *Symbol, const MCExpr *Value) { | |
| } | ||
| } | ||
|
|
||
| getStreamer().emitThumbFunc(Symbol); | ||
| emitThumbFunc(Symbol); | ||
| getStreamer().emitAssignment(Symbol, Value); | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to check this was intentional. I don't see any problems with it, but at first glance it doesn't look related.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Making the function public is intentional as mentioned by the description:
In the call site, the previous
getParser().getStreamer().emitThumbFunc(Symbol);somehow was able to accessemitThumbFunc, despite it being private. Perhaps there was afriendsomewhere.The new
getTargetStreamer().emitThumbFunc(Symbol);does requireemitThumbFuncto be public.