aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/MC/MCAsmLayout.h
blob: d2b5e4a507cb8d612488b5a942f3b2fa6ab46778 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//===- MCAsmLayout.h - Assembly Layout Object -------------------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_MC_MCASMLAYOUT_H
#define LLVM_MC_MCASMLAYOUT_H

namespace llvm {
class MCAssembler;

/// Encapsulates the layout of an assembly file at a particular point in time.
///
/// Assembly may requiring compute multiple layouts for a particular assembly
/// file as part of the relaxation process. This class encapsulates the layout
/// at a single point in time in such a way that it is always possible to
/// efficiently compute the exact addresses of any symbol in the assembly file,
/// even during the relaxation process.
class MCAsmLayout {
private:
  uint64_t CurrentLocation;

  MCAssembler &Assembler;

public:
  MCAsmLayout(MCAssembler &_Assembler)
    : CurrentLocation(0), Assembler(_Assember) {}

  /// Get the assembler object this is a layout for.
  MCAssembler &getAssembler() { return Assembler; }

  /// Get the current location value, i.e. that value of the '.' expression.
  uin64_t getCurrentLocation() {
    return CurrentLocation;
  }

  /// Set the current location.
  void setCurrentLocation(uint64_t Value) {
    CurrentLocation = Value;
  }
};

} // end namespace llvm

#endif