1 //===-- llvm/CodeGen/MachineLocation.h --------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
9 // The MachineLocation class is used to represent a simple location in a machine
10 // frame. Locations will be one of two forms; a register or an address formed
11 // from a base address plus an offset. Register indirection can be specified by
12 // using an offset of zero.
14 // The MachineMove class is used to represent abstract move operations in the
15 // prolog/epilog of a compiled function. A collection of these objects can be
16 // used by a debug consumer to track the location of values when unwinding stack
18 //===----------------------------------------------------------------------===//
21 #ifndef LLVM_CODEGEN_MACHINELOCATION_H
22 #define LLVM_CODEGEN_MACHINELOCATION_H
26 class MachineLocation {
28 bool IsRegister; // True if location is a register.
29 unsigned Register; // gcc/gdb register number.
30 int Offset; // Displacement if not register.
34 // The target register number for an abstract frame pointer. The value is
35 // an arbitrary value greater than TargetRegisterInfo::FirstVirtualRegister.
43 explicit MachineLocation(unsigned R)
48 MachineLocation(unsigned R, int O)
55 bool isReg() const { return IsRegister; }
56 unsigned getReg() const { return Register; }
57 int getOffset() const { return Offset; }
58 void setIsRegister(bool Is) { IsRegister = Is; }
59 void setRegister(unsigned R) { Register = R; }
60 void setOffset(int O) { Offset = O; }
61 void set(unsigned R) {
66 void set(unsigned R, int O) {
79 unsigned LabelID; // Label ID number for post-instruction
80 // address when result of move takes
82 MachineLocation Destination; // Move to location.
83 MachineLocation Source; // Move from location.
92 MachineMove(unsigned ID, MachineLocation &D, MachineLocation &S)
99 unsigned getLabelID() const { return LabelID; }
100 const MachineLocation &getDestination() const { return Destination; }
101 const MachineLocation &getSource() const { return Source; }
104 } // End llvm namespace