LCOV - code coverage report
Current view: top level - lib/CodeGen/AsmPrinter - AddressPool.cpp (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 16 16 100.0 %
Date: 2018-05-20 00:06:23 Functions: 2 2 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //===- llvm/CodeGen/AddressPool.cpp - Dwarf Debug Framework ---------------===//
       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 "AddressPool.h"
      11             : #include "llvm/ADT/SmallVector.h"
      12             : #include "llvm/CodeGen/AsmPrinter.h"
      13             : #include "llvm/IR/DataLayout.h"
      14             : #include "llvm/MC/MCStreamer.h"
      15             : #include "llvm/Target/TargetLoweringObjectFile.h"
      16             : #include <utility>
      17             : 
      18             : using namespace llvm;
      19             : 
      20        9347 : unsigned AddressPool::getIndex(const MCSymbol *Sym, bool TLS) {
      21        9347 :   HasBeenUsed = true;
      22             :   auto IterBool =
      23       28041 :       Pool.insert(std::make_pair(Sym, AddressPoolEntry(Pool.size(), TLS)));
      24        9347 :   return IterBool.first->second.Number;
      25             : }
      26             : 
      27             : // Emit addresses into the section given.
      28         593 : void AddressPool::emit(AsmPrinter &Asm, MCSection *AddrSection) {
      29         593 :   if (Pool.empty())
      30           3 :     return;
      31             : 
      32             :   // Start the dwarf addr section.
      33         590 :   Asm.OutStreamer->SwitchSection(AddrSection);
      34             : 
      35             :   // Order the address pool entries by ID
      36        1770 :   SmallVector<const MCExpr *, 64> Entries(Pool.size());
      37             : 
      38       10462 :   for (const auto &I : Pool)
      39       18564 :     Entries[I.second.Number] =
      40        9282 :         I.second.TLS
      41        9282 :             ? Asm.getObjFileLowering().getDebugThreadLocalSymbol(I.first)
      42        9278 :             : MCSymbolRefExpr::create(I.first, Asm.OutContext);
      43             : 
      44       19154 :   for (const MCExpr *Entry : Entries)
      45        9282 :     Asm.OutStreamer->EmitValue(Entry, Asm.getDataLayout().getPointerSize());
      46             : }

Generated by: LCOV version 1.13