Path: blob/main/contrib/llvm-project/llvm/lib/CodeGen/AsmPrinter/AddressPool.h
35271 views
//===- llvm/CodeGen/AddressPool.h - Dwarf Debug Framework -------*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#ifndef LLVM_LIB_CODEGEN_ASMPRINTER_ADDRESSPOOL_H9#define LLVM_LIB_CODEGEN_ASMPRINTER_ADDRESSPOOL_H1011#include "llvm/ADT/DenseMap.h"1213namespace llvm {1415class AsmPrinter;16class MCSection;17class MCSymbol;1819// Collection of addresses for this unit and assorted labels.20// A Symbol->unsigned mapping of addresses used by indirect21// references.22class AddressPool {23struct AddressPoolEntry {24unsigned Number;25bool TLS;2627AddressPoolEntry(unsigned Number, bool TLS) : Number(Number), TLS(TLS) {}28};29DenseMap<const MCSymbol *, AddressPoolEntry> Pool;3031/// Record whether the AddressPool has been queried for an address index since32/// the last "resetUsedFlag" call. Used to implement type unit fallback - a33/// type that references addresses cannot be placed in a type unit when using34/// fission.35bool HasBeenUsed = false;3637public:38AddressPool() = default;3940/// Returns the index into the address pool with the given41/// label/symbol.42unsigned getIndex(const MCSymbol *Sym, bool TLS = false);4344void emit(AsmPrinter &Asm, MCSection *AddrSection);4546bool isEmpty() { return Pool.empty(); }4748bool hasBeenUsed() const { return HasBeenUsed; }4950void resetUsedFlag(bool HasBeenUsed = false) { this->HasBeenUsed = HasBeenUsed; }5152MCSymbol *getLabel() { return AddressTableBaseSym; }53void setLabel(MCSymbol *Sym) { AddressTableBaseSym = Sym; }5455private:56MCSymbol *emitHeader(AsmPrinter &Asm, MCSection *Section);5758/// Symbol designates the start of the contribution to the address table.59MCSymbol *AddressTableBaseSym = nullptr;60};6162} // end namespace llvm6364#endif // LLVM_LIB_CODEGEN_ASMPRINTER_ADDRESSPOOL_H656667