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 | d4c0dd47765c729bf502f8ee96fdec6f5b3695fe (patch) | |
| tree | ebd88be1d5fca42a323c15ec3ae1c475af7a3bf6 /llvm/include | |
| parent | 9de821ebfd344b04b45df335dc324d3d126ef42a (diff) | |
| download | bcm5719-llvm-d4c0dd47765c729bf502f8ee96fdec6f5b3695fe.tar.gz bcm5719-llvm-d4c0dd47765c729bf502f8ee96fdec6f5b3695fe.zip | |
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
llvm-svn: 180641
Diffstat (limited to 'llvm/include')
| -rw-r--r-- | llvm/include/llvm/MC/MachineLocation.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/include/llvm/MC/MachineLocation.h b/llvm/include/llvm/MC/MachineLocation.h index 5caad337f82..83c8b72ee4a 100644 --- a/llvm/include/llvm/MC/MachineLocation.h +++ b/llvm/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; |

