[llvm] r190335 - Call generateCompactUnwindEncodings() right before we need to output the frame information.
Rafael EspĂndola
rafael.espindola at gmail.com
Fri Oct 18 08:52:46 PDT 2013
testcase?
On 9 September 2013 15:48, Bill Wendling <isanbard at gmail.com> wrote:
> Author: void
> Date: Mon Sep 9 14:48:37 2013
> New Revision: 190335
>
> URL: http://llvm.org/viewvc/llvm-project?rev=190335&view=rev
> Log:
> Call generateCompactUnwindEncodings() right before we need to output the frame information.
>
> There are more than one paths to where the frame information is emitted. Place
> the call to generateCompactUnwindEncodings() into the method which outputs the
> frame information, thus ensuring that the encoding is there for every path. This
> involved threading the MCAsmBackend object through to this method.
>
> <rdar://problem/13623355>
>
> Modified:
> llvm/trunk/include/llvm/MC/MCDwarf.h
> llvm/trunk/include/llvm/MC/MCStreamer.h
> llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp
> llvm/trunk/lib/MC/MCAsmStreamer.cpp
> llvm/trunk/lib/MC/MCDwarf.cpp
> llvm/trunk/lib/MC/MCELFStreamer.cpp
> llvm/trunk/lib/MC/MCMachOStreamer.cpp
> llvm/trunk/lib/MC/MCStreamer.cpp
>
> Modified: llvm/trunk/include/llvm/MC/MCDwarf.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCDwarf.h?rev=190335&r1=190334&r2=190335&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/MC/MCDwarf.h (original)
> +++ llvm/trunk/include/llvm/MC/MCDwarf.h Mon Sep 9 14:48:37 2013
> @@ -23,6 +23,7 @@
> #include <vector>
>
> namespace llvm {
> +class MCAsmBackend;
> class MCContext;
> class MCSection;
> class MCStreamer;
> @@ -449,7 +450,8 @@ public:
> //
> // This emits the frame info section.
> //
> - static void Emit(MCStreamer &streamer, bool usingCFI, bool isEH);
> + static void Emit(MCStreamer &streamer, MCAsmBackend *MAB,
> + bool usingCFI, bool isEH);
> static void EmitAdvanceLoc(MCStreamer &Streamer, uint64_t AddrDelta);
> static void EncodeAdvanceLoc(MCContext &Context, uint64_t AddrDelta,
> raw_ostream &OS);
>
> Modified: llvm/trunk/include/llvm/MC/MCStreamer.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCStreamer.h?rev=190335&r1=190334&r2=190335&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/MC/MCStreamer.h (original)
> +++ llvm/trunk/include/llvm/MC/MCStreamer.h Mon Sep 9 14:48:37 2013
> @@ -104,7 +104,7 @@ protected:
> virtual void EmitCFIStartProcImpl(MCDwarfFrameInfo &Frame);
> void RecordProcEnd(MCDwarfFrameInfo &Frame);
> virtual void EmitCFIEndProcImpl(MCDwarfFrameInfo &CurFrame);
> - void EmitFrames(bool usingCFI);
> + void EmitFrames(MCAsmBackend *MAB, bool usingCFI);
>
> MCWin64EHUnwindInfo *getCurrentW64UnwindInfo() {
> return CurrentW64UnwindInfo;
> @@ -134,7 +134,7 @@ public:
> return *W64UnwindInfos[i];
> }
>
> - void generateCompactUnwindEncodings(MCAsmBackend &MAB);
> + void generateCompactUnwindEncodings(MCAsmBackend *MAB);
>
> /// @name Assembly File Formatting.
> /// @{
>
> Modified: llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp?rev=190335&r1=190334&r2=190335&view=diff
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp (original)
> +++ llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp Mon Sep 9 14:48:37 2013
> @@ -175,12 +175,11 @@ bool LLVMTargetMachine::addPassesToEmitF
>
> // Create a code emitter if asked to show the encoding.
> MCCodeEmitter *MCE = 0;
> - MCAsmBackend *MAB = 0;
> - if (ShowMCEncoding) {
> + if (ShowMCEncoding)
> MCE = getTarget().createMCCodeEmitter(MII, MRI, STI, *Context);
> - MAB = getTarget().createMCAsmBackend(MRI, getTargetTriple(), TargetCPU);
> - }
>
> + MCAsmBackend *MAB = getTarget().createMCAsmBackend(MRI, getTargetTriple(),
> + TargetCPU);
> MCStreamer *S = getTarget().createAsmStreamer(*Context, Out,
> getVerboseAsm(),
> hasMCUseLoc(),
>
> Modified: llvm/trunk/lib/MC/MCAsmStreamer.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmStreamer.cpp?rev=190335&r1=190334&r2=190335&view=diff
> ==============================================================================
> --- llvm/trunk/lib/MC/MCAsmStreamer.cpp (original)
> +++ llvm/trunk/lib/MC/MCAsmStreamer.cpp Mon Sep 9 14:48:37 2013
> @@ -1421,8 +1421,9 @@ void MCAsmStreamer::FinishImpl() {
> MCGenDwarfInfo::Emit(this, LineSectionSymbol);
>
> if (!UseCFI)
> - EmitFrames(false);
> + EmitFrames(AsmBackend.get(), false);
> }
> +
> MCStreamer *llvm::createAsmStreamer(MCContext &Context,
> formatted_raw_ostream &OS,
> bool isVerboseAsm, bool useLoc,
>
> Modified: llvm/trunk/lib/MC/MCDwarf.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCDwarf.cpp?rev=190335&r1=190334&r2=190335&view=diff
> ==============================================================================
> --- llvm/trunk/lib/MC/MCDwarf.cpp (original)
> +++ llvm/trunk/lib/MC/MCDwarf.cpp Mon Sep 9 14:48:37 2013
> @@ -1415,9 +1415,10 @@ namespace llvm {
> };
> }
>
> -void MCDwarfFrameEmitter::Emit(MCStreamer &Streamer,
> - bool UsingCFI,
> - bool IsEH) {
> +void MCDwarfFrameEmitter::Emit(MCStreamer &Streamer, MCAsmBackend *MAB,
> + bool UsingCFI, bool IsEH) {
> + Streamer.generateCompactUnwindEncodings(MAB);
> +
> MCContext &Context = Streamer.getContext();
> const MCObjectFileInfo *MOFI = Context.getObjectFileInfo();
> FrameEmitterImpl Emitter(UsingCFI, IsEH);
>
> Modified: llvm/trunk/lib/MC/MCELFStreamer.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCELFStreamer.cpp?rev=190335&r1=190334&r2=190335&view=diff
> ==============================================================================
> --- llvm/trunk/lib/MC/MCELFStreamer.cpp (original)
> +++ llvm/trunk/lib/MC/MCELFStreamer.cpp Mon Sep 9 14:48:37 2013
> @@ -528,7 +528,7 @@ void MCELFStreamer::EmitBundleUnlock() {
> }
>
> void MCELFStreamer::FinishImpl() {
> - EmitFrames(true);
> + EmitFrames(NULL, true);
>
> for (std::vector<LocalCommon>::const_iterator i = LocalCommons.begin(),
> e = LocalCommons.end();
>
> Modified: llvm/trunk/lib/MC/MCMachOStreamer.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCMachOStreamer.cpp?rev=190335&r1=190334&r2=190335&view=diff
> ==============================================================================
> --- llvm/trunk/lib/MC/MCMachOStreamer.cpp (original)
> +++ llvm/trunk/lib/MC/MCMachOStreamer.cpp Mon Sep 9 14:48:37 2013
> @@ -396,8 +396,7 @@ void MCMachOStreamer::EmitInstToData(con
> }
>
> void MCMachOStreamer::FinishImpl() {
> - generateCompactUnwindEncodings(getAssembler().getBackend());
> - EmitFrames(true);
> + EmitFrames(&getAssembler().getBackend(), true);
>
> // We have to set the fragment atom associations so we can relax properly for
> // Mach-O.
>
> Modified: llvm/trunk/lib/MC/MCStreamer.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCStreamer.cpp?rev=190335&r1=190334&r2=190335&view=diff
> ==============================================================================
> --- llvm/trunk/lib/MC/MCStreamer.cpp (original)
> +++ llvm/trunk/lib/MC/MCStreamer.cpp Mon Sep 9 14:48:37 2013
> @@ -73,12 +73,12 @@ raw_ostream &MCStreamer::GetCommentOS()
> return nulls();
> }
>
> -void MCStreamer::generateCompactUnwindEncodings(MCAsmBackend &MAB) {
> +void MCStreamer::generateCompactUnwindEncodings(MCAsmBackend *MAB) {
> + if (!MAB) return;
> for (std::vector<MCDwarfFrameInfo>::iterator I = FrameInfos.begin(),
> E = FrameInfos.end(); I != E; ++I)
> - if (!I->CompactUnwindEncoding)
> - I->CompactUnwindEncoding =
> - MAB.generateCompactUnwindEncoding(I->Instructions);
> + I->CompactUnwindEncoding =
> + MAB->generateCompactUnwindEncoding(I->Instructions);
> }
>
> void MCStreamer::EmitDwarfSetLineAddr(int64_t LineDelta,
> @@ -604,15 +604,15 @@ void MCStreamer::EmitRawText(const Twine
> EmitRawText(Str.str());
> }
>
> -void MCStreamer::EmitFrames(bool usingCFI) {
> +void MCStreamer::EmitFrames(MCAsmBackend *MAB, bool usingCFI) {
> if (!getNumFrameInfos())
> return;
>
> if (EmitEHFrame)
> - MCDwarfFrameEmitter::Emit(*this, usingCFI, true);
> + MCDwarfFrameEmitter::Emit(*this, MAB, usingCFI, true);
>
> if (EmitDebugFrame)
> - MCDwarfFrameEmitter::Emit(*this, usingCFI, false);
> + MCDwarfFrameEmitter::Emit(*this, MAB, usingCFI, false);
> }
>
> void MCStreamer::EmitW64Tables() {
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list