mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-05-28 00:40:54 +00:00
Rename FunctionFrameInfo to MachineFrameInfo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5201 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
eb24db9727
commit
aa09b75d22
@ -1,6 +1,6 @@
|
|||||||
//===-- CodeGen/FunctionFrameInfo.h - Abstract Stack Frame Rep --*- C++ -*-===//
|
//===-- CodeGen/MachineFrameInfo.h - Abstract Stack Frame Rep. --*- C++ -*-===//
|
||||||
//
|
//
|
||||||
// The FunctionFrameInfo class represents an abstract stack frame until
|
// The MachineFrameInfo class represents an abstract stack frame until
|
||||||
// prolog/epilog code is inserted. This class is key to allowing stack frame
|
// prolog/epilog code is inserted. This class is key to allowing stack frame
|
||||||
// representation optimizations, such as frame pointer elimination. It also
|
// representation optimizations, such as frame pointer elimination. It also
|
||||||
// allows more mundane (but still important) optimizations, such as reordering
|
// allows more mundane (but still important) optimizations, such as reordering
|
||||||
@ -31,7 +31,7 @@
|
|||||||
#ifndef LLVM_CODEGEN_FUNCTIONFRAMEINFO_H
|
#ifndef LLVM_CODEGEN_FUNCTIONFRAMEINFO_H
|
||||||
#define LLVM_CODEGEN_FUNCTIONFRAMEINFO_H
|
#define LLVM_CODEGEN_FUNCTIONFRAMEINFO_H
|
||||||
|
|
||||||
class FunctionFrameInfo {
|
class MachineFrameInfo {
|
||||||
|
|
||||||
// StackObject - Represent a single object allocated on the stack.
|
// StackObject - Represent a single object allocated on the stack.
|
||||||
struct StackObject {
|
struct StackObject {
|
||||||
@ -83,7 +83,7 @@ class FunctionFrameInfo {
|
|||||||
///
|
///
|
||||||
unsigned MaxCallFrameSize;
|
unsigned MaxCallFrameSize;
|
||||||
public:
|
public:
|
||||||
FunctionFrameInfo() {
|
MachineFrameInfo() {
|
||||||
NumFixedObjects = StackSize = 0;
|
NumFixedObjects = StackSize = 0;
|
||||||
HasVarSizedObjects = false;
|
HasVarSizedObjects = false;
|
||||||
HasCalls = false;
|
HasCalls = false;
|
||||||
@ -181,7 +181,7 @@ public:
|
|||||||
return Objects.size()-NumFixedObjects-1;
|
return Objects.size()-NumFixedObjects-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// CreateVariableSizedObject - Notify the FunctionFrameInfo object that a
|
/// CreateVariableSizedObject - Notify the MachineFrameInfo object that a
|
||||||
/// variable sized object has been created. This must be created whenever a
|
/// variable sized object has been created. This must be created whenever a
|
||||||
/// variable sized object is created, whether or not the index returned is
|
/// variable sized object is created, whether or not the index returned is
|
||||||
/// actually used.
|
/// actually used.
|
||||||
|
@ -20,7 +20,7 @@ class TargetMachine;
|
|||||||
class Pass;
|
class Pass;
|
||||||
class SSARegMap;
|
class SSARegMap;
|
||||||
class MachineFunctionInfo;
|
class MachineFunctionInfo;
|
||||||
class FunctionFrameInfo;
|
class MachineFrameInfo;
|
||||||
|
|
||||||
Pass *createMachineCodeConstructionPass(TargetMachine &Target);
|
Pass *createMachineCodeConstructionPass(TargetMachine &Target);
|
||||||
Pass *createMachineCodeDestructionPass();
|
Pass *createMachineCodeDestructionPass();
|
||||||
@ -40,7 +40,7 @@ class MachineFunction : private Annotation {
|
|||||||
MachineFunctionInfo *MFInfo;
|
MachineFunctionInfo *MFInfo;
|
||||||
|
|
||||||
// Keep track of objects allocated on the stack.
|
// Keep track of objects allocated on the stack.
|
||||||
FunctionFrameInfo *FrameInfo;
|
MachineFrameInfo *FrameInfo;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MachineFunction(const Function *Fn, const TargetMachine& target);
|
MachineFunction(const Function *Fn, const TargetMachine& target);
|
||||||
@ -64,7 +64,7 @@ public:
|
|||||||
/// This object contains information about objects allocated on the stack
|
/// This object contains information about objects allocated on the stack
|
||||||
/// frame of the current function in an abstract way.
|
/// frame of the current function in an abstract way.
|
||||||
///
|
///
|
||||||
FunctionFrameInfo *getFrameInfo() const { return FrameInfo; }
|
MachineFrameInfo *getFrameInfo() const { return FrameInfo; }
|
||||||
|
|
||||||
/// MachineFunctionInfo - Keep track of various per-function pieces of
|
/// MachineFunctionInfo - Keep track of various per-function pieces of
|
||||||
/// information for the sparc backend.
|
/// information for the sparc backend.
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
#include "llvm/CodeGen/MachineFunction.h"
|
#include "llvm/CodeGen/MachineFunction.h"
|
||||||
#include "llvm/CodeGen/MachineInstrBuilder.h"
|
#include "llvm/CodeGen/MachineInstrBuilder.h"
|
||||||
#include "llvm/CodeGen/SSARegMap.h"
|
#include "llvm/CodeGen/SSARegMap.h"
|
||||||
#include "llvm/CodeGen/FunctionFrameInfo.h"
|
#include "llvm/CodeGen/MachineFrameInfo.h"
|
||||||
#include "llvm/Target/TargetMachine.h"
|
#include "llvm/Target/TargetMachine.h"
|
||||||
#include "llvm/Support/InstVisitor.h"
|
#include "llvm/Support/InstVisitor.h"
|
||||||
#include "llvm/Target/MRegisterInfo.h"
|
#include "llvm/Target/MRegisterInfo.h"
|
||||||
@ -345,7 +345,7 @@ void ISel::LoadArgumentsToVirtualRegs(Function &Fn) {
|
|||||||
// ...
|
// ...
|
||||||
//
|
//
|
||||||
unsigned ArgOffset = 0;
|
unsigned ArgOffset = 0;
|
||||||
FunctionFrameInfo *FFI = F->getFrameInfo();
|
MachineFrameInfo *MFI = F->getFrameInfo();
|
||||||
|
|
||||||
for (Function::aiterator I = Fn.abegin(), E = Fn.aend(); I != E; ++I) {
|
for (Function::aiterator I = Fn.abegin(), E = Fn.aend(); I != E; ++I) {
|
||||||
unsigned Reg = getReg(*I);
|
unsigned Reg = getReg(*I);
|
||||||
@ -355,26 +355,26 @@ void ISel::LoadArgumentsToVirtualRegs(Function &Fn) {
|
|||||||
|
|
||||||
switch (getClassB(I->getType())) {
|
switch (getClassB(I->getType())) {
|
||||||
case cByte:
|
case cByte:
|
||||||
FI = FFI->CreateFixedObject(1, ArgOffset);
|
FI = MFI->CreateFixedObject(1, ArgOffset);
|
||||||
addFrameReference(BuildMI(BB, X86::MOVmr8, 4, Reg), FI);
|
addFrameReference(BuildMI(BB, X86::MOVmr8, 4, Reg), FI);
|
||||||
break;
|
break;
|
||||||
case cShort:
|
case cShort:
|
||||||
FI = FFI->CreateFixedObject(2, ArgOffset);
|
FI = MFI->CreateFixedObject(2, ArgOffset);
|
||||||
addFrameReference(BuildMI(BB, X86::MOVmr16, 4, Reg), FI);
|
addFrameReference(BuildMI(BB, X86::MOVmr16, 4, Reg), FI);
|
||||||
break;
|
break;
|
||||||
case cInt:
|
case cInt:
|
||||||
FI = FFI->CreateFixedObject(4, ArgOffset);
|
FI = MFI->CreateFixedObject(4, ArgOffset);
|
||||||
addFrameReference(BuildMI(BB, X86::MOVmr32, 4, Reg), FI);
|
addFrameReference(BuildMI(BB, X86::MOVmr32, 4, Reg), FI);
|
||||||
break;
|
break;
|
||||||
case cFP:
|
case cFP:
|
||||||
unsigned Opcode;
|
unsigned Opcode;
|
||||||
if (I->getType() == Type::FloatTy) {
|
if (I->getType() == Type::FloatTy) {
|
||||||
Opcode = X86::FLDr32;
|
Opcode = X86::FLDr32;
|
||||||
FI = FFI->CreateFixedObject(4, ArgOffset);
|
FI = MFI->CreateFixedObject(4, ArgOffset);
|
||||||
} else {
|
} else {
|
||||||
Opcode = X86::FLDr64;
|
Opcode = X86::FLDr64;
|
||||||
ArgOffset += 4; // doubles require 4 additional bytes
|
ArgOffset += 4; // doubles require 4 additional bytes
|
||||||
FI = FFI->CreateFixedObject(8, ArgOffset);
|
FI = MFI->CreateFixedObject(8, ArgOffset);
|
||||||
}
|
}
|
||||||
addFrameReference(BuildMI(BB, Opcode, 4, Reg), FI);
|
addFrameReference(BuildMI(BB, Opcode, 4, Reg), FI);
|
||||||
break;
|
break;
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
#include "llvm/CodeGen/MachineFunction.h"
|
#include "llvm/CodeGen/MachineFunction.h"
|
||||||
#include "llvm/CodeGen/MachineInstrBuilder.h"
|
#include "llvm/CodeGen/MachineInstrBuilder.h"
|
||||||
#include "llvm/CodeGen/SSARegMap.h"
|
#include "llvm/CodeGen/SSARegMap.h"
|
||||||
#include "llvm/CodeGen/FunctionFrameInfo.h"
|
#include "llvm/CodeGen/MachineFrameInfo.h"
|
||||||
#include "llvm/Target/TargetMachine.h"
|
#include "llvm/Target/TargetMachine.h"
|
||||||
#include "llvm/Support/InstVisitor.h"
|
#include "llvm/Support/InstVisitor.h"
|
||||||
#include "llvm/Target/MRegisterInfo.h"
|
#include "llvm/Target/MRegisterInfo.h"
|
||||||
@ -345,7 +345,7 @@ void ISel::LoadArgumentsToVirtualRegs(Function &Fn) {
|
|||||||
// ...
|
// ...
|
||||||
//
|
//
|
||||||
unsigned ArgOffset = 0;
|
unsigned ArgOffset = 0;
|
||||||
FunctionFrameInfo *FFI = F->getFrameInfo();
|
MachineFrameInfo *MFI = F->getFrameInfo();
|
||||||
|
|
||||||
for (Function::aiterator I = Fn.abegin(), E = Fn.aend(); I != E; ++I) {
|
for (Function::aiterator I = Fn.abegin(), E = Fn.aend(); I != E; ++I) {
|
||||||
unsigned Reg = getReg(*I);
|
unsigned Reg = getReg(*I);
|
||||||
@ -355,26 +355,26 @@ void ISel::LoadArgumentsToVirtualRegs(Function &Fn) {
|
|||||||
|
|
||||||
switch (getClassB(I->getType())) {
|
switch (getClassB(I->getType())) {
|
||||||
case cByte:
|
case cByte:
|
||||||
FI = FFI->CreateFixedObject(1, ArgOffset);
|
FI = MFI->CreateFixedObject(1, ArgOffset);
|
||||||
addFrameReference(BuildMI(BB, X86::MOVmr8, 4, Reg), FI);
|
addFrameReference(BuildMI(BB, X86::MOVmr8, 4, Reg), FI);
|
||||||
break;
|
break;
|
||||||
case cShort:
|
case cShort:
|
||||||
FI = FFI->CreateFixedObject(2, ArgOffset);
|
FI = MFI->CreateFixedObject(2, ArgOffset);
|
||||||
addFrameReference(BuildMI(BB, X86::MOVmr16, 4, Reg), FI);
|
addFrameReference(BuildMI(BB, X86::MOVmr16, 4, Reg), FI);
|
||||||
break;
|
break;
|
||||||
case cInt:
|
case cInt:
|
||||||
FI = FFI->CreateFixedObject(4, ArgOffset);
|
FI = MFI->CreateFixedObject(4, ArgOffset);
|
||||||
addFrameReference(BuildMI(BB, X86::MOVmr32, 4, Reg), FI);
|
addFrameReference(BuildMI(BB, X86::MOVmr32, 4, Reg), FI);
|
||||||
break;
|
break;
|
||||||
case cFP:
|
case cFP:
|
||||||
unsigned Opcode;
|
unsigned Opcode;
|
||||||
if (I->getType() == Type::FloatTy) {
|
if (I->getType() == Type::FloatTy) {
|
||||||
Opcode = X86::FLDr32;
|
Opcode = X86::FLDr32;
|
||||||
FI = FFI->CreateFixedObject(4, ArgOffset);
|
FI = MFI->CreateFixedObject(4, ArgOffset);
|
||||||
} else {
|
} else {
|
||||||
Opcode = X86::FLDr64;
|
Opcode = X86::FLDr64;
|
||||||
ArgOffset += 4; // doubles require 4 additional bytes
|
ArgOffset += 4; // doubles require 4 additional bytes
|
||||||
FI = FFI->CreateFixedObject(8, ArgOffset);
|
FI = MFI->CreateFixedObject(8, ArgOffset);
|
||||||
}
|
}
|
||||||
addFrameReference(BuildMI(BB, Opcode, 4, Reg), FI);
|
addFrameReference(BuildMI(BB, Opcode, 4, Reg), FI);
|
||||||
break;
|
break;
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
#include "llvm/Type.h"
|
#include "llvm/Type.h"
|
||||||
#include "llvm/CodeGen/MachineInstrBuilder.h"
|
#include "llvm/CodeGen/MachineInstrBuilder.h"
|
||||||
#include "llvm/CodeGen/MachineFunction.h"
|
#include "llvm/CodeGen/MachineFunction.h"
|
||||||
#include "llvm/CodeGen/FunctionFrameInfo.h"
|
#include "llvm/CodeGen/MachineFrameInfo.h"
|
||||||
#include "Support/CommandLine.h"
|
#include "Support/CommandLine.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@ -139,8 +139,8 @@ void X86RegisterInfo::eliminateFrameIndex(MachineFunction &MF,
|
|||||||
int Offset = MF.getFrameInfo()->getObjectOffset(FrameIndex);
|
int Offset = MF.getFrameInfo()->getObjectOffset(FrameIndex);
|
||||||
|
|
||||||
if (!hasFP(MF) && hasSPAdjust(MF)) {
|
if (!hasFP(MF) && hasSPAdjust(MF)) {
|
||||||
const FunctionFrameInfo *FFI = MF.getFrameInfo();
|
const MachineFrameInfo *MFI = MF.getFrameInfo();
|
||||||
Offset += FFI->getStackSize() + FFI->getMaxCallFrameSize();
|
Offset += MFI->getStackSize() + MFI->getMaxCallFrameSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
MI.SetMachineOperandConst(i, MachineOperand::MO_SignExtendedImmed, Offset);
|
MI.SetMachineOperandConst(i, MachineOperand::MO_SignExtendedImmed, Offset);
|
||||||
@ -159,15 +159,15 @@ void X86RegisterInfo::processFunctionBeforeFrameFinalized(MachineFunction &MF)
|
|||||||
void X86RegisterInfo::emitPrologue(MachineFunction &MF) const {
|
void X86RegisterInfo::emitPrologue(MachineFunction &MF) const {
|
||||||
MachineBasicBlock &MBB = MF.front(); // Prolog goes in entry BB
|
MachineBasicBlock &MBB = MF.front(); // Prolog goes in entry BB
|
||||||
MachineBasicBlock::iterator MBBI = MBB.begin();
|
MachineBasicBlock::iterator MBBI = MBB.begin();
|
||||||
const FunctionFrameInfo *FFI = MF.getFrameInfo();
|
const MachineFrameInfo *MFI = MF.getFrameInfo();
|
||||||
MachineInstr *MI;
|
MachineInstr *MI;
|
||||||
|
|
||||||
// Get the number of bytes to allocate from the FrameInfo
|
// Get the number of bytes to allocate from the FrameInfo
|
||||||
unsigned NumBytes = FFI->getStackSize();
|
unsigned NumBytes = MFI->getStackSize();
|
||||||
if (hasFP(MF)) {
|
if (hasFP(MF)) {
|
||||||
// Get the offset of the stack slot for the EBP register... which is
|
// Get the offset of the stack slot for the EBP register... which is
|
||||||
// guaranteed to be the last slot by processFunctionBeforeFrameFinalized.
|
// guaranteed to be the last slot by processFunctionBeforeFrameFinalized.
|
||||||
int EBPOffset = FFI->getObjectOffset(FFI->getObjectIndexEnd()-1);
|
int EBPOffset = MFI->getObjectOffset(MFI->getObjectIndexEnd()-1);
|
||||||
|
|
||||||
MI = addRegOffset(BuildMI(X86::MOVrm32, 5), // mov [ESP-<offset>], EBP
|
MI = addRegOffset(BuildMI(X86::MOVrm32, 5), // mov [ESP-<offset>], EBP
|
||||||
X86::ESP, EBPOffset).addReg(X86::EBP);
|
X86::ESP, EBPOffset).addReg(X86::EBP);
|
||||||
@ -187,7 +187,7 @@ void X86RegisterInfo::emitPrologue(MachineFunction &MF) const {
|
|||||||
// in the function immediately on entry to the current function. This
|
// in the function immediately on entry to the current function. This
|
||||||
// eliminates the need for add/sub ESP brackets around call sites.
|
// eliminates the need for add/sub ESP brackets around call sites.
|
||||||
//
|
//
|
||||||
NumBytes += FFI->getMaxCallFrameSize();
|
NumBytes += MFI->getMaxCallFrameSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NumBytes) {
|
if (NumBytes) {
|
||||||
@ -199,7 +199,7 @@ void X86RegisterInfo::emitPrologue(MachineFunction &MF) const {
|
|||||||
|
|
||||||
void X86RegisterInfo::emitEpilogue(MachineFunction &MF,
|
void X86RegisterInfo::emitEpilogue(MachineFunction &MF,
|
||||||
MachineBasicBlock &MBB) const {
|
MachineBasicBlock &MBB) const {
|
||||||
const FunctionFrameInfo *FFI = MF.getFrameInfo();
|
const MachineFrameInfo *MFI = MF.getFrameInfo();
|
||||||
MachineBasicBlock::iterator MBBI = MBB.end()-1;
|
MachineBasicBlock::iterator MBBI = MBB.end()-1;
|
||||||
MachineInstr *MI;
|
MachineInstr *MI;
|
||||||
assert((*MBBI)->getOpcode() == X86::RET &&
|
assert((*MBBI)->getOpcode() == X86::RET &&
|
||||||
@ -208,7 +208,7 @@ void X86RegisterInfo::emitEpilogue(MachineFunction &MF,
|
|||||||
if (hasFP(MF)) {
|
if (hasFP(MF)) {
|
||||||
// Get the offset of the stack slot for the EBP register... which is
|
// Get the offset of the stack slot for the EBP register... which is
|
||||||
// guaranteed to be the last slot by processFunctionBeforeFrameFinalized.
|
// guaranteed to be the last slot by processFunctionBeforeFrameFinalized.
|
||||||
int EBPOffset = FFI->getObjectOffset(FFI->getObjectIndexEnd()-1);
|
int EBPOffset = MFI->getObjectOffset(MFI->getObjectIndexEnd()-1);
|
||||||
|
|
||||||
// mov ESP, EBP
|
// mov ESP, EBP
|
||||||
MI = BuildMI(X86::MOVrr32, 1,X86::ESP).addReg(X86::EBP);
|
MI = BuildMI(X86::MOVrr32, 1,X86::ESP).addReg(X86::EBP);
|
||||||
@ -221,8 +221,8 @@ void X86RegisterInfo::emitEpilogue(MachineFunction &MF,
|
|||||||
if (!hasSPAdjust(MF)) return;
|
if (!hasSPAdjust(MF)) return;
|
||||||
|
|
||||||
// Get the number of bytes allocated from the FrameInfo...
|
// Get the number of bytes allocated from the FrameInfo...
|
||||||
unsigned NumBytes = FFI->getStackSize();
|
unsigned NumBytes = MFI->getStackSize();
|
||||||
NumBytes += FFI->getMaxCallFrameSize();
|
NumBytes += MFI->getMaxCallFrameSize();
|
||||||
|
|
||||||
if (NumBytes) { // adjust stack pointer back: ESP += numbytes
|
if (NumBytes) { // adjust stack pointer back: ESP += numbytes
|
||||||
MI =BuildMI(X86::ADDri32, 2, X86::ESP).addReg(X86::ESP).addZImm(NumBytes);
|
MI =BuildMI(X86::ADDri32, 2, X86::ESP).addReg(X86::ESP).addZImm(NumBytes);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user