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
27 class MachineLocation {
29 bool IsRegister; // True if location is a register.
30 unsigned Register; // gcc/gdb register number.
31 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.
39 : IsRegister(false), Register(0), Offset(0) {}
40 explicit MachineLocation(unsigned R)
41 : IsRegister(true), Register(R), Offset(0) {}
42 MachineLocation(unsigned R, int O)
43 : IsRegister(false), Register(R), Offset(O) {}
46 bool isReg() const { return IsRegister; }
47 unsigned getReg() const { return Register; }
48 int getOffset() const { return Offset; }
49 void setIsRegister(bool Is) { IsRegister = Is; }
50 void setRegister(unsigned R) { Register = R; }
51 void setOffset(int O) { Offset = O; }
52 void set(unsigned R) {
57 void set(unsigned R, int O) {
68 /// MachineMove - This class represents the save or restore of a callee saved
69 /// register that exception or debug info needs to know about.
72 /// Label - Symbol for post-instruction address when result of move takes
76 // Move to & from location.
77 MachineLocation Destination, Source;
79 MachineMove() : Label(0) {}
81 MachineMove(MCSymbol *label, const MachineLocation &D,
82 const MachineLocation &S)
83 : Label(label), Destination(D), Source(S) {}
86 MCSymbol *getLabel() const { return Label; }
87 const MachineLocation &getDestination() const { return Destination; }
88 const MachineLocation &getSource() const { return Source; }
91 } // End llvm namespace