summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCAsmStreamer.cpp
diff options
context:
space:
mode:
authorTim Northover <tnorthover@apple.com>2014-03-29 07:34:53 +0000
committerTim Northover <tnorthover@apple.com>2014-03-29 07:34:53 +0000
commit53d32518512bb30d0c43376bdd334ddfa0dbcd64 (patch)
treeb5df1bf6cf477afa53cf56c89c5fe8d51dbf5eff /llvm/lib/MC/MCAsmStreamer.cpp
parent5627670e8429c811032971211cfe3da89f0221b4 (diff)
downloadbcm5719-llvm-53d32518512bb30d0c43376bdd334ddfa0dbcd64.tar.gz
bcm5719-llvm-53d32518512bb30d0c43376bdd334ddfa0dbcd64.zip
MachO: Add linker-optimisation hint framework to MC.
Another part of the ARM64 backend (so tests will be following soon). This is currently used by the linker to relax adrp/ldr pairs into nops where possible, though could well be more broadly applicable. llvm-svn: 205084
Diffstat (limited to 'llvm/lib/MC/MCAsmStreamer.cpp')
-rw-r--r--llvm/lib/MC/MCAsmStreamer.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/llvm/lib/MC/MCAsmStreamer.cpp b/llvm/lib/MC/MCAsmStreamer.cpp
index 59af4101afa..cc30d056a21 100644
--- a/llvm/lib/MC/MCAsmStreamer.cpp
+++ b/llvm/lib/MC/MCAsmStreamer.cpp
@@ -126,6 +126,7 @@ public:
void ChangeSection(const MCSection *Section,
const MCExpr *Subsection) override;
+ void EmitLOHDirective(MCLOHType Kind, const MCLOHArgs &Args) override;
void EmitLabel(MCSymbol *Symbol) override;
void EmitDebugLabel(MCSymbol *Symbol) override;
@@ -342,6 +343,27 @@ void MCAsmStreamer::EmitLabel(MCSymbol *Symbol) {
EmitEOL();
}
+void MCAsmStreamer::EmitLOHDirective(MCLOHType Kind, const MCLOHArgs &Args) {
+ StringRef str = MCLOHIdToName(Kind);
+
+#ifndef NDEBUG
+ int NbArgs = MCLOHIdToNbArgs(Kind);
+ assert(NbArgs != -1 && ((size_t)NbArgs) == Args.size() && "Malformed LOH!");
+ assert(str != "" && "Invalid LOH name");
+#endif
+
+ OS << "\t" << MCLOHDirectiveName() << " " << str << "\t";
+ bool IsFirst = true;
+ for (MCLOHArgs::const_iterator It = Args.begin(), EndIt = Args.end();
+ It != EndIt; ++It) {
+ if (!IsFirst)
+ OS << ", ";
+ IsFirst = false;
+ OS << **It;
+ }
+ EmitEOL();
+}
+
void MCAsmStreamer::EmitDebugLabel(MCSymbol *Symbol) {
assert(Symbol->isUndefined() && "Cannot define a symbol twice!");
MCStreamer::EmitDebugLabel(Symbol);
OpenPOWER on IntegriCloud