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: 2017-09-14 15:23:50 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          78 : unsigned AddressPool::getIndex(const MCSymbol *Sym, bool TLS) {
      21          78 :   HasBeenUsed = true;
      22             :   auto IterBool =
      23         390 :       Pool.insert(std::make_pair(Sym, AddressPoolEntry(Pool.size(), TLS)));
      24          78 :   return IterBool.first->second.Number;
      25             : }
      26             : 
      27             : // Emit addresses into the section given.
      28          23 : void AddressPool::emit(AsmPrinter &Asm, MCSection *AddrSection) {
      29          46 :   if (Pool.empty())
      30           3 :     return;
      31             : 
      32             :   // Start the dwarf addr section.
      33          40 :   Asm.OutStreamer->SwitchSection(AddrSection);
      34             : 
      35             :   // Order the address pool entries by ID
      36          80 :   SmallVector<const MCExpr *, 64> Entries(Pool.size());
      37             : 
      38         125 :   for (const auto &I : Pool)
      39         130 :     Entries[I.second.Number] =
      40          65 :         I.second.TLS
      41         128 :             ? Asm.getObjFileLowering().getDebugThreadLocalSymbol(I.first)
      42          63 :             : MCSymbolRefExpr::create(I.first, Asm.OutContext);
      43             : 
      44         125 :   for (const MCExpr *Entry : Entries)
      45         130 :     Asm.OutStreamer->EmitValue(Entry, Asm.getDataLayout().getPointerSize());
      46             : }

Generated by: LCOV version 1.13