LLVM  4.0.0
AddressPool.h
Go to the documentation of this file.
1 //===-- llvm/CodeGen/AddressPool.h - Dwarf Debug Framework -----*- 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 
10 #ifndef LLVM_LIB_CODEGEN_ASMPRINTER_ADDRESSPOOL_H
11 #define LLVM_LIB_CODEGEN_ASMPRINTER_ADDRESSPOOL_H
12 
13 #include "llvm/ADT/DenseMap.h"
14 #include "llvm/MC/MCSymbol.h"
15 
16 namespace llvm {
17 class MCSection;
18 class AsmPrinter;
19 // Collection of addresses for this unit and assorted labels.
20 // A Symbol->unsigned mapping of addresses used by indirect
21 // references.
22 class AddressPool {
23  struct AddressPoolEntry {
24  unsigned Number;
25  bool TLS;
26  AddressPoolEntry(unsigned Number, bool TLS) : Number(Number), TLS(TLS) {}
27  };
29 
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
33  /// fission.
34  bool HasBeenUsed;
35 
36 public:
37  AddressPool() : HasBeenUsed(false) {}
38 
39  /// \brief Returns the index into the address pool with the given
40  /// label/symbol.
41  unsigned getIndex(const MCSymbol *Sym, bool TLS = false);
42 
43  void emit(AsmPrinter &Asm, MCSection *AddrSection);
44 
45  bool isEmpty() { return Pool.empty(); }
46 
47  bool hasBeenUsed() const { return HasBeenUsed; }
48 
49  void resetUsedFlag() { HasBeenUsed = false; }
50 };
51 }
52 #endif
Instances of this class represent a uniqued identifier for a section in the current translation unit...
Definition: MCSection.h:40
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:39
bool hasBeenUsed() const
Definition: AddressPool.h:47
Function Alias Analysis false
void emit(AsmPrinter &Asm, MCSection *AddrSection)
Definition: AddressPool.cpp:25
This class is intended to be used as a driving class for all asm writers.
Definition: AsmPrinter.h:67
void resetUsedFlag()
Definition: AddressPool.h:49
unsigned getIndex(const MCSymbol *Sym, bool TLS=false)
Returns the index into the address pool with the given label/symbol.
Definition: AddressPool.cpp:17