mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 03:33:20 +01:00
Added methods to read/write values to stack in .h, fixed implementation in
.cpp to return the iterator correctly. llvm-svn: 4827
This commit is contained in:
parent
23d923ff18
commit
02c0acabb9
@ -1,4 +1,4 @@
|
|||||||
//===- X86RegisterInfo.cpp - X86 Register Information ---------------------===//
|
//===- X86RegisterInfo.cpp - X86 Register Information -----------*- C++ -*-===//
|
||||||
//
|
//
|
||||||
// This file contains the X86 implementation of the MRegisterInfo class.
|
// This file contains the X86 implementation of the MRegisterInfo class.
|
||||||
//
|
//
|
||||||
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include "X86.h"
|
#include "X86.h"
|
||||||
#include "X86RegisterInfo.h"
|
#include "X86RegisterInfo.h"
|
||||||
|
#include "X86InstrBuilder.h"
|
||||||
#include "llvm/Constants.h"
|
#include "llvm/Constants.h"
|
||||||
#include "llvm/Type.h"
|
#include "llvm/Type.h"
|
||||||
#include "llvm/CodeGen/MachineInstrBuilder.h"
|
#include "llvm/CodeGen/MachineInstrBuilder.h"
|
||||||
@ -23,23 +24,35 @@ X86RegisterInfo::X86RegisterInfo()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void X86RegisterInfo::copyReg2PCRel(MachineBasicBlock *MBB,
|
MachineBasicBlock::iterator
|
||||||
|
X86RegisterInfo::storeReg2RegOffset(MachineBasicBlock *MBB,
|
||||||
MachineBasicBlock::iterator &MBBI,
|
MachineBasicBlock::iterator &MBBI,
|
||||||
unsigned SrcReg, unsigned ImmOffset,
|
unsigned SrcReg, unsigned DestReg,
|
||||||
unsigned dataSize) const
|
unsigned ImmOffset, unsigned dataSize)
|
||||||
|
const
|
||||||
{
|
{
|
||||||
MachineInstrBuilder MI = BuildMI(X86::MOVmr32, 2)
|
MachineInstr *MI = addRegOffset(BuildMI(X86::MOVmr32, 5).addReg(SrcReg),
|
||||||
.addPCDisp(ConstantUInt::get(Type::UIntTy, ImmOffset)).addReg(SrcReg);
|
DestReg, ImmOffset);
|
||||||
MBB->insert(MBBI, &*MI);
|
return ++(MBB->insert(MBBI, MI));
|
||||||
}
|
}
|
||||||
|
|
||||||
void X86RegisterInfo::copyPCRel2Reg(MachineBasicBlock *MBB,
|
MachineBasicBlock::iterator
|
||||||
MachineBasicBlock::iterator &MBBI,
|
X86RegisterInfo::loadRegOffset2Reg(MachineBasicBlock *MBB,
|
||||||
unsigned ImmOffset, unsigned DestReg,
|
MachineBasicBlock::iterator &MBBI,
|
||||||
unsigned dataSize) const
|
unsigned DestReg, unsigned SrcReg,
|
||||||
|
unsigned ImmOffset, unsigned dataSize)
|
||||||
|
const
|
||||||
{
|
{
|
||||||
MachineInstrBuilder MI = BuildMI(X86::MOVrm32, 2)
|
MachineInstr *MI = addRegOffset(BuildMI(X86::MOVrm32, 5).addReg(DestReg),
|
||||||
.addReg(DestReg).addPCDisp(ConstantUInt::get(Type::UIntTy, ImmOffset));
|
SrcReg, ImmOffset);
|
||||||
MBB->insert(MBBI, &*MI);
|
return ++(MBB->insert(MBBI, MI));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
unsigned X86RegisterInfo::getFramePointer() const {
|
||||||
|
return X86::EBP;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned X86RegisterInfo::getStackPointer() const {
|
||||||
|
return X86::ESP;
|
||||||
|
}
|
||||||
|
@ -17,15 +17,20 @@ struct X86RegisterInfo : public MRegisterInfo {
|
|||||||
MRegisterInfo::const_iterator const_regclass_begin() const;
|
MRegisterInfo::const_iterator const_regclass_begin() const;
|
||||||
MRegisterInfo::const_iterator const_regclass_end() const;
|
MRegisterInfo::const_iterator const_regclass_end() const;
|
||||||
|
|
||||||
void copyReg2PCRel(MachineBasicBlock *MBB,
|
MachineBasicBlock::iterator
|
||||||
|
storeReg2RegOffset(MachineBasicBlock *MBB,
|
||||||
MachineBasicBlock::iterator &MBBI,
|
MachineBasicBlock::iterator &MBBI,
|
||||||
unsigned SrcReg, unsigned ImmOffset,
|
unsigned DestReg, unsigned SrcReg,
|
||||||
unsigned dataSize) const;
|
unsigned ImmOffset, unsigned dataSize) const;
|
||||||
|
|
||||||
void copyPCRel2Reg(MachineBasicBlock *MBB,
|
MachineBasicBlock::iterator
|
||||||
MachineBasicBlock::iterator &MBBI,
|
loadRegOffset2Reg(MachineBasicBlock *MBB,
|
||||||
unsigned ImmOffset, unsigned DestReg,
|
MachineBasicBlock::iterator &MBBI,
|
||||||
unsigned dataSize) const;
|
unsigned DestReg, unsigned SrcReg,
|
||||||
|
unsigned ImmOffset, unsigned dataSize) const;
|
||||||
|
|
||||||
|
unsigned getFramePointer() const;
|
||||||
|
unsigned getStackPointer() const;
|
||||||
|
|
||||||
/// Returns register class appropriate for input SSA register
|
/// Returns register class appropriate for input SSA register
|
||||||
///
|
///
|
||||||
|
Loading…
Reference in New Issue
Block a user