mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-19 18:24:00 +00:00
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205084 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
30
lib/MC/MCLinkerOptimizationHint.cpp
Normal file
30
lib/MC/MCLinkerOptimizationHint.cpp
Normal file
@ -0,0 +1,30 @@
|
||||
//===-- llvm/MC/MCLinkerOptimizationHint.cpp ----- LOH handling -*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/MC/MCLinkerOptimizationHint.h"
|
||||
#include "llvm/MC/MCAsmLayout.h"
|
||||
#include "llvm/Support/LEB128.h"
|
||||
#include "llvm/MC/MCStreamer.h"
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
namespace llvm {
|
||||
template<>
|
||||
void MCLOHDirective::Emit_impl(raw_ostream &OutStream,
|
||||
const MachObjectWriter &ObjWriter,
|
||||
const MCAsmLayout &Layout) const {
|
||||
const MCAssembler &Asm = Layout.getAssembler();
|
||||
encodeULEB128(Kind, OutStream);
|
||||
encodeULEB128(Args.size(), OutStream);
|
||||
for (LOHArgs::const_iterator It = Args.begin(), EndIt = Args.end();
|
||||
It != EndIt; ++It)
|
||||
encodeULEB128(ObjWriter.getSymbolAddress(&Asm.getSymbolData(**It), Layout),
|
||||
OutStream);
|
||||
}
|
||||
} // end namespace llvm
|
Reference in New Issue
Block a user