LLVM  3.7.0
MCLinkerOptimizationHint.cpp
Go to the documentation of this file.
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 
11 #include "llvm/MC/MCAsmLayout.h"
12 #include "llvm/MC/MCAssembler.h"
13 #include "llvm/Support/LEB128.h"
14 
15 using namespace llvm;
16 
17 // Each LOH is composed by, in this order (each field is encoded using ULEB128):
18 // - Its kind.
19 // - Its number of arguments (let say N).
20 // - Its arg1.
21 // - ...
22 // - Its argN.
23 // <arg1> to <argN> are absolute addresses in the object file, i.e.,
24 // relative addresses from the beginning of the object file.
25 void MCLOHDirective::emit_impl(raw_ostream &OutStream,
26  const MachObjectWriter &ObjWriter,
27  const MCAsmLayout &Layout) const {
28  encodeULEB128(Kind, OutStream);
29  encodeULEB128(Args.size(), OutStream);
30  for (LOHArgs::const_iterator It = Args.begin(), EndIt = Args.end();
31  It != EndIt; ++It)
32  encodeULEB128(ObjWriter.getSymbolAddress(**It, Layout), OutStream);
33 }
Encapsulates the layout of an assembly file at a particular point in time.
Definition: MCAsmLayout.h:29
const ARM::ArchExtKind Kind
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:38
void encodeULEB128(uint64_t Value, raw_ostream &OS, unsigned Padding=0)
Utility function to encode a ULEB128 value to an output stream.
Definition: LEB128.h:38
uint64_t getSymbolAddress(const MCSymbol &S, const MCAsmLayout &Layout) const