MCAsmLayout.h revision 207e06ea0446c51cb1d89f6400ec7becc46487f8
1//===- MCAsmLayout.h - Assembly Layout Object -------------------*- 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_MC_MCASMLAYOUT_H 11#define LLVM_MC_MCASMLAYOUT_H 12 13namespace llvm { 14class MCAssembler; 15class MCFragment; 16class MCSectionData; 17class MCSymbolData; 18 19/// Encapsulates the layout of an assembly file at a particular point in time. 20/// 21/// Assembly may requiring compute multiple layouts for a particular assembly 22/// file as part of the relaxation process. This class encapsulates the layout 23/// at a single point in time in such a way that it is always possible to 24/// efficiently compute the exact addresses of any symbol in the assembly file, 25/// even during the relaxation process. 26class MCAsmLayout { 27private: 28 MCAssembler &Assembler; 29 30public: 31 MCAsmLayout(MCAssembler &_Assembler) : Assembler(_Assembler) {} 32 33 /// Get the assembler object this is a layout for. 34 MCAssembler &getAssembler() const { return Assembler; } 35 36 uint64_t getFragmentAddress(const MCFragment *F) const; 37 38 uint64_t getSectionAddress(const MCSectionData *SD) const; 39 40 uint64_t getSymbolAddress(const MCSymbolData *SD) const; 41 42 void setSectionAddress(MCSectionData *SD, uint64_t Value); 43}; 44 45} // end namespace llvm 46 47#endif 48