MC: Sketch initial MCAsmLayout class, which encapsulates the current layout of an...
[oota-llvm.git] / include / llvm / MC / MCAsmLayout.h
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
13 namespace llvm {
14 class MCAssembler;
15
16 /// Encapsulates the layout of an assembly file at a particular point in time.
17 ///
18 /// Assembly may requiring compute multiple layouts for a particular assembly
19 /// file as part of the relaxation process. This class encapsulates the layout
20 /// at a single point in time in such a way that it is always possible to
21 /// efficiently compute the exact addresses of any symbol in the assembly file,
22 /// even during the relaxation process.
23 class MCAsmLayout {
24 private:
25   uint64_t CurrentLocation;
26
27   MCAssembler &Assembler;
28
29 public:
30   MCAsmLayout(MCAssembler &_Assembler)
31     : CurrentLocation(0), Assembler(_Assember) {}
32
33   /// Get the assembler object this is a layout for.
34   MCAssembler &getAssembler() { return Assembler; }
35
36   /// Get the current location value, i.e. that value of the '.' expression.
37   uin64_t getCurrentLocation() {
38     return CurrentLocation;
39   }
40
41   /// Set the current location.
42   void setCurrentLocation(uint64_t Value) {
43     CurrentLocation = Value;
44   }
45 };
46
47 } // end namespace llvm
48
49 #endif