1 //===-- llvm/CodeGen/AddressPool.h - Dwarf Debug Framework -----*- C++ -*--===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef CODEGEN_ASMPRINTER_ADDRESSPOOL_H__
11 #define CODEGEN_ASMPRINTER_ADDRESSPOOL_H__
13 #include "llvm/ADT/DenseMap.h"
19 // Collection of addresses for this unit and assorted labels.
20 // A Symbol->unsigned mapping of addresses used by indirect
23 struct AddressPoolEntry {
26 AddressPoolEntry(unsigned Number, bool TLS) : Number(Number), TLS(TLS) {}
28 DenseMap<const MCSymbol *, AddressPoolEntry> Pool;
30 /// Record whether the AddressPool has been queried for an address index since
31 /// the last "resetUsedFlag" call. Used to implement type unit fallback - a
32 /// type that references addresses cannot be placed in a type unit when using
37 AddressPool() : HasBeenUsed(false) {}
39 /// \brief Returns the index into the address pool with the given
41 unsigned getIndex(const MCSymbol *Sym, bool TLS = false);
43 void emit(AsmPrinter &Asm, const MCSection *AddrSection);
45 bool isEmpty() { return Pool.empty(); }
47 bool hasBeenUsed() const { return HasBeenUsed; }
49 void resetUsedFlag() { HasBeenUsed = false; }