diff options
author | Adrian Prantl <aprantl@apple.com> | 2013-04-26 21:57:17 +0000 |
---|---|---|
committer | Adrian Prantl <aprantl@apple.com> | 2013-04-26 21:57:17 +0000 |
commit | 13131e62fc9a523b3cc8ad98cc9def97ff89391a (patch) | |
tree | ef646ee0be31a359251092688ea9c04c0b9ef91d /include/llvm/MC/MachineLocation.h | |
parent | f1d9fe9d04ce93f6d5dcebbd2cb6a07414d7a029 (diff) |
Cleanup and document MachineLocation.
Clarify documentation and API to make the difference between register and
register-indirect addressed locations more explicit. Put in a comment
to point out that with the current implementation we cannot specify
a register-indirect location with offset 0 (a breg 0 in DWARF).
No functionality change intended.
rdar://problem/13658587
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180641 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/MC/MachineLocation.h')
-rw-r--r-- | include/llvm/MC/MachineLocation.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/include/llvm/MC/MachineLocation.h b/include/llvm/MC/MachineLocation.h index 5caad337f8..83c8b72ee4 100644 --- a/include/llvm/MC/MachineLocation.h +++ b/include/llvm/MC/MachineLocation.h @@ -9,7 +9,7 @@ // The MachineLocation class is used to represent a simple location in a machine // frame. Locations will be one of two forms; a register or an address formed // from a base address plus an offset. Register indirection can be specified by -// using an offset of zero. +// explicitly passing an offset to the constructor. // // The MachineMove class is used to represent abstract move operations in the // prolog/epilog of a compiled function. A collection of these objects can be @@ -37,8 +37,10 @@ public: }; MachineLocation() : IsRegister(false), Register(0), Offset(0) {} + /// Create a direct register location. explicit MachineLocation(unsigned R) : IsRegister(true), Register(R), Offset(0) {} + /// Create a register-indirect location with an offset. MachineLocation(unsigned R, int O) : IsRegister(false), Register(R), Offset(O) {} @@ -48,17 +50,20 @@ public: } // Accessors + bool isIndirect() const { return !IsRegister; } bool isReg() const { return IsRegister; } unsigned getReg() const { return Register; } int getOffset() const { return Offset; } void setIsRegister(bool Is) { IsRegister = Is; } void setRegister(unsigned R) { Register = R; } void setOffset(int O) { Offset = O; } + /// Make this location a direct register location. void set(unsigned R) { IsRegister = true; Register = R; Offset = 0; } + /// Make this location a register-indirect+offset location. void set(unsigned R, int O) { IsRegister = false; Register = R; |