mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-05 14:34:55 +00:00
[PR2327] Leverage TargetRegisterInfo to compute frame offsets for GC metadata.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54994 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
2d450ebe18
commit
fcbcfaa95f
@ -26,6 +26,7 @@
|
|||||||
#include "llvm/Target/TargetFrameInfo.h"
|
#include "llvm/Target/TargetFrameInfo.h"
|
||||||
#include "llvm/Target/TargetInstrInfo.h"
|
#include "llvm/Target/TargetInstrInfo.h"
|
||||||
#include "llvm/Target/TargetMachine.h"
|
#include "llvm/Target/TargetMachine.h"
|
||||||
|
#include "llvm/Target/TargetRegisterInfo.h"
|
||||||
#include "llvm/Support/Compiler.h"
|
#include "llvm/Support/Compiler.h"
|
||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
@ -356,14 +357,12 @@ void MachineCodeAnalysis::FindSafePoints(MachineFunction &MF) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MachineCodeAnalysis::FindStackOffsets(MachineFunction &MF) {
|
void MachineCodeAnalysis::FindStackOffsets(MachineFunction &MF) {
|
||||||
uint64_t StackSize = MFI->getStackSize();
|
const TargetRegisterInfo *TRI = TM->getRegisterInfo();
|
||||||
uint64_t OffsetAdjustment = MFI->getOffsetAdjustment();
|
assert(TRI && "TargetRegisterInfo not available!");
|
||||||
uint64_t OffsetOfLocalArea = TM->getFrameInfo()->getOffsetOfLocalArea();
|
|
||||||
|
|
||||||
for (GCFunctionInfo::roots_iterator RI = FI->roots_begin(),
|
for (GCFunctionInfo::roots_iterator RI = FI->roots_begin(),
|
||||||
RE = FI->roots_end(); RI != RE; ++RI)
|
RE = FI->roots_end(); RI != RE; ++RI)
|
||||||
RI->StackOffset = MFI->getObjectOffset(RI->Num) + StackSize
|
RI->StackOffset = TRI->getFrameIndexOffset(MF, RI->Num);
|
||||||
- OffsetOfLocalArea + OffsetAdjustment;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MachineCodeAnalysis::runOnMachineFunction(MachineFunction &MF) {
|
bool MachineCodeAnalysis::runOnMachineFunction(MachineFunction &MF) {
|
||||||
@ -378,10 +377,9 @@ bool MachineCodeAnalysis::runOnMachineFunction(MachineFunction &MF) {
|
|||||||
TM = &MF.getTarget();
|
TM = &MF.getTarget();
|
||||||
MMI = &getAnalysis<MachineModuleInfo>();
|
MMI = &getAnalysis<MachineModuleInfo>();
|
||||||
TII = TM->getInstrInfo();
|
TII = TM->getInstrInfo();
|
||||||
MFI = MF.getFrameInfo();
|
|
||||||
|
|
||||||
// Find the size of the stack frame.
|
// Find the size of the stack frame.
|
||||||
FI->setFrameSize(MFI->getStackSize());
|
FI->setFrameSize(MF.getFrameInfo()->getStackSize());
|
||||||
|
|
||||||
// Find all safe points.
|
// Find all safe points.
|
||||||
FindSafePoints(MF);
|
FindSafePoints(MF);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user