mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-23 01:24:30 +00:00
MRegisterInfo::getLocation() is a really bad idea. Its function is to calculate the offset from frame pointer to a stack slot and then storing the delta in a MachineLocation object. The name is bad (it implies a getter), and MRegisterInfo doesn't need to know about MachineLocation.
Replace getLocation() with getFrameIndexOffset() which returns the delta from frame pointer to stack slot. Dwarf writer can then use the information for whatever it wants. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46597 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -27,7 +27,6 @@ namespace llvm {
|
|||||||
class BitVector;
|
class BitVector;
|
||||||
class MachineFunction;
|
class MachineFunction;
|
||||||
class MachineInstr;
|
class MachineInstr;
|
||||||
class MachineLocation;
|
|
||||||
class MachineMove;
|
class MachineMove;
|
||||||
class RegScavenger;
|
class RegScavenger;
|
||||||
class SDNode;
|
class SDNode;
|
||||||
@ -587,17 +586,14 @@ public:
|
|||||||
/// for values allocated in the current stack frame.
|
/// for values allocated in the current stack frame.
|
||||||
virtual unsigned getFrameRegister(MachineFunction &MF) const = 0;
|
virtual unsigned getFrameRegister(MachineFunction &MF) const = 0;
|
||||||
|
|
||||||
|
/// getFrameIndexOffset - Returns the displacement from the frame register to
|
||||||
|
/// the stack frame of the specified index.
|
||||||
|
virtual int getFrameIndexOffset(MachineFunction &MF, unsigned FI) const;
|
||||||
|
|
||||||
/// getRARegister - This method should return the register where the return
|
/// getRARegister - This method should return the register where the return
|
||||||
/// address can be found.
|
/// address can be found.
|
||||||
virtual unsigned getRARegister() const = 0;
|
virtual unsigned getRARegister() const = 0;
|
||||||
|
|
||||||
/// getLocation - This method should return the actual location of a frame
|
|
||||||
/// variable given the frame index. The location is returned in ML.
|
|
||||||
/// Subclasses should override this method for special handling of frame
|
|
||||||
/// variables and call MRegisterInfo::getLocation for the default action.
|
|
||||||
virtual void getLocation(MachineFunction &MF, unsigned Index,
|
|
||||||
MachineLocation &ML) const;
|
|
||||||
|
|
||||||
/// getInitialFrameState - Returns a list of machine moves that are assumed
|
/// getInitialFrameState - Returns a list of machine moves that are assumed
|
||||||
/// on entry to all functions. Note that LabelID is ignored (assumed to be
|
/// on entry to all functions. Note that LabelID is ignored (assumed to be
|
||||||
/// the beginning of the function.)
|
/// the beginning of the function.)
|
||||||
|
@ -1875,7 +1875,8 @@ private:
|
|||||||
|
|
||||||
// Add variable address.
|
// Add variable address.
|
||||||
MachineLocation Location;
|
MachineLocation Location;
|
||||||
RI->getLocation(*MF, DV->getFrameIndex(), Location);
|
Location.set(RI->getFrameRegister(*MF),
|
||||||
|
RI->getFrameIndexOffset(*MF, DV->getFrameIndex()));
|
||||||
AddAddress(VariableDie, DW_AT_location, Location);
|
AddAddress(VariableDie, DW_AT_location, Location);
|
||||||
|
|
||||||
return VariableDie;
|
return VariableDie;
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
#include "llvm/Target/TargetFrameInfo.h"
|
#include "llvm/Target/TargetFrameInfo.h"
|
||||||
#include "llvm/CodeGen/MachineFunction.h"
|
#include "llvm/CodeGen/MachineFunction.h"
|
||||||
#include "llvm/CodeGen/MachineFrameInfo.h"
|
#include "llvm/CodeGen/MachineFrameInfo.h"
|
||||||
#include "llvm/CodeGen/MachineLocation.h"
|
|
||||||
#include "llvm/ADT/BitVector.h"
|
#include "llvm/ADT/BitVector.h"
|
||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
@ -72,19 +71,14 @@ BitVector MRegisterInfo::getAllocatableSet(MachineFunction &MF,
|
|||||||
return Allocatable;
|
return Allocatable;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// getLocation - This method should return the actual location of a frame
|
/// getFrameIndexOffset - Returns the displacement from the frame register to
|
||||||
/// variable given the frame index. The location is returned in ML.
|
/// the stack frame of the specified index. This is the default implementation
|
||||||
/// Subclasses should override this method for special handling of frame
|
/// which is likely incorrect for the target.
|
||||||
/// variables and then call MRegisterInfo::getLocation for the default action.
|
int MRegisterInfo::getFrameIndexOffset(MachineFunction &MF, unsigned FI) const {
|
||||||
void MRegisterInfo::getLocation(MachineFunction &MF, unsigned Index,
|
|
||||||
MachineLocation &ML) const {
|
|
||||||
const TargetFrameInfo &TFI = *MF.getTarget().getFrameInfo();
|
const TargetFrameInfo &TFI = *MF.getTarget().getFrameInfo();
|
||||||
MachineFrameInfo *MFI = MF.getFrameInfo();
|
MachineFrameInfo *MFI = MF.getFrameInfo();
|
||||||
ML.set(getFrameRegister(MF),
|
return MFI->getObjectOffset(FI) + MFI->getStackSize() -
|
||||||
MFI->getObjectOffset(Index) +
|
TFI.getOffsetOfLocalArea() + MFI->getOffsetAdjustment();
|
||||||
MFI->getStackSize() -
|
|
||||||
TFI.getOffsetOfLocalArea() +
|
|
||||||
MFI->getOffsetAdjustment());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// getInitialFrameState - Returns a list of machine moves that are assumed
|
/// getInitialFrameState - Returns a list of machine moves that are assumed
|
||||||
|
Reference in New Issue
Block a user