llvm.org GIT mirror llvm / 60f27ff
Support for locating of debug items in frames. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26984 91177308-0d34-0410-b5e6-96231b3b80d8 Jim Laskey 14 years ago
1 changed file(s) with 64 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 //===-- llvm/CodeGen/MachineLocation.h --------------------------*- C++ -*-===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file was developed by James M. Laskey and is distributed under
5 // the University of Illinois Open Source License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8 // The MachineLocation class is used to represent a simple location in a machine
9 // frame. Locations will be one of two forms; a register or an address formed
10 // from a base address plus an offset.
11 //===----------------------------------------------------------------------===//
12
13
14 #ifndef LLVM_CODEGEN_MACHINELOCATION_H
15 #define LLVM_CODEGEN_MACHINELOCATION_H
16
17 namespace llvm {
18
19 class MachineLocation {
20 private:
21 bool IsRegister; // True if location is a register.
22 unsigned Register; // gcc/gdb register number.
23 int Offset; // Displacement if not register.
24
25 public:
26 MachineLocation()
27 : IsRegister(false)
28 , Register(0)
29 , Offset(0)
30 {}
31 MachineLocation(unsigned R)
32 : IsRegister(true)
33 , Register(R)
34 , Offset(0)
35 {}
36 MachineLocation(unsigned R, int O)
37 : IsRegister(false)
38 , Register(R)
39 , Offset(0)
40 {}
41
42 // Accessors
43 bool isRegister() const { return IsRegister; }
44 unsigned getRegister() const { return Register; }
45 int getOffset() const { return Offset; }
46 void setIsRegister(bool Is) { IsRegister = Is; }
47 void setRegister(unsigned R) { Register = R; }
48 void setOffset(int O) { Offset = O; }
49 void set(unsigned R) {
50 IsRegister = true;
51 Register = R;
52 Offset = 0;
53 }
54 void set(unsigned R, int O) {
55 IsRegister = false;
56 Register = R;
57 Offset = O;
58 }
59 };
60
61 } // End llvm namespace
62
63 #endif