From 485d905510388e2b57375b5d3e70f4e6462eccf9 Mon Sep 17 00:00:00 2001 From: Colin LeMahieu Date: Wed, 27 Apr 2016 21:26:13 +0000 Subject: [PATCH] [MCAssembler] Allow backend to finalize layout post-relaxation. Differential revision: http://reviews.llvm.org/D19429 llvm-svn: 267796 --- llvm/include/llvm/MC/MCAsmBackend.h | 4 ++++ llvm/lib/MC/MCAssembler.cpp | 1 + 2 files changed, 5 insertions(+) diff --git a/llvm/include/llvm/MC/MCAsmBackend.h b/llvm/include/llvm/MC/MCAsmBackend.h index 40ff8e3..a4d7348 100644 --- a/llvm/include/llvm/MC/MCAsmBackend.h +++ b/llvm/include/llvm/MC/MCAsmBackend.h @@ -126,6 +126,10 @@ public: /// \return - True on success. virtual bool writeNopData(uint64_t Count, MCObjectWriter *OW) const = 0; + /// Give backend an opportunity to finish layout after relaxation + virtual void finishLayout(MCAssembler const &Asm, + MCAsmLayout &Layout) const {} + /// Handle any target-specific assembler flags. By default, do nothing. virtual void handleAssemblerFlag(MCAssemblerFlag Flag) {} diff --git a/llvm/lib/MC/MCAssembler.cpp b/llvm/lib/MC/MCAssembler.cpp index ca8ccb4..4bb0dda 100644 --- a/llvm/lib/MC/MCAssembler.cpp +++ b/llvm/lib/MC/MCAssembler.cpp @@ -914,4 +914,5 @@ void MCAssembler::finishLayout(MCAsmLayout &Layout) { for (unsigned int i = 0, n = Layout.getSectionOrder().size(); i != n; ++i) { Layout.getFragmentOffset(&*Layout.getSectionOrder()[i]->rbegin()); } + getBackend().finishLayout(*this, Layout); } -- 2.7.4