MachO: Add linker-optimisation hint framework to MC.
[oota-llvm.git] / lib / MC / MCLinkerOptimizationHint.cpp
1 //===-- llvm/MC/MCLinkerOptimizationHint.cpp ----- LOH handling -*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #include "llvm/MC/MCLinkerOptimizationHint.h"
11 #include "llvm/MC/MCAsmLayout.h"
12 #include "llvm/Support/LEB128.h"
13 #include "llvm/MC/MCStreamer.h"
14
15 using namespace llvm;
16
17 namespace llvm {
18 template<>
19 void MCLOHDirective::Emit_impl(raw_ostream &OutStream,
20                                const MachObjectWriter &ObjWriter,
21                                const MCAsmLayout &Layout) const {
22   const MCAssembler &Asm = Layout.getAssembler();
23   encodeULEB128(Kind, OutStream);
24   encodeULEB128(Args.size(), OutStream);
25   for (LOHArgs::const_iterator It = Args.begin(), EndIt = Args.end();
26        It != EndIt; ++It)
27     encodeULEB128(ObjWriter.getSymbolAddress(&Asm.getSymbolData(**It), Layout),
28                   OutStream);
29 }
30 } // end namespace llvm