mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-01 05:01:59 +01:00
[PR2327] Leverage TargetRegisterInfo to compute frame offsets for GC metadata.
llvm-svn: 54994
This commit is contained in:
parent
2f08e00f01
commit
c4e022d917
@ -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