mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-19 19:29:31 +00:00
Some functions are in X86RegisterInfo.cpp, others, because of the data they need, are in X86RegisterClasses.cpp, which also defines some register classes: byte, short, and int. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4784 91177308-0d34-0410-b5e6-96231b3b80d8
46 lines
1.5 KiB
C++
46 lines
1.5 KiB
C++
//===- X86RegisterInfo.cpp - X86 Register Information ---------------------===//
|
|
//
|
|
// This file contains the X86 implementation of the MRegisterInfo class.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "X86.h"
|
|
#include "X86RegisterInfo.h"
|
|
#include "llvm/Constants.h"
|
|
#include "llvm/Type.h"
|
|
#include "llvm/CodeGen/MachineInstrBuilder.h"
|
|
|
|
// X86Regs - Turn the X86RegisterInfo.def file into a bunch of register
|
|
// descriptors
|
|
//
|
|
static const MRegisterDesc X86Regs[] = {
|
|
#define R(ENUM, NAME, FLAGS, TSFLAGS) { NAME, FLAGS, TSFLAGS },
|
|
#include "X86RegisterInfo.def"
|
|
};
|
|
|
|
X86RegisterInfo::X86RegisterInfo()
|
|
: MRegisterInfo(X86Regs, sizeof(X86Regs)/sizeof(X86Regs[0])) {
|
|
}
|
|
|
|
|
|
void X86RegisterInfo::copyReg2PCRel(MachineBasicBlock *MBB,
|
|
MachineBasicBlock::iterator &MBBI,
|
|
unsigned SrcReg, unsigned ImmOffset,
|
|
unsigned dataSize) const
|
|
{
|
|
MachineInstrBuilder MI = BuildMI(X86::MOVmr32, 2)
|
|
.addPCDisp(ConstantUInt::get(Type::UIntTy, ImmOffset)).addReg(SrcReg);
|
|
MBB->insert(MBBI, &*MI);
|
|
}
|
|
|
|
void X86RegisterInfo::copyPCRel2Reg(MachineBasicBlock *MBB,
|
|
MachineBasicBlock::iterator &MBBI,
|
|
unsigned ImmOffset, unsigned DestReg,
|
|
unsigned dataSize) const
|
|
{
|
|
MachineInstrBuilder MI = BuildMI(X86::MOVrm32, 2)
|
|
.addReg(DestReg).addPCDisp(ConstantUInt::get(Type::UIntTy, ImmOffset));
|
|
MBB->insert(MBBI, &*MI);
|
|
}
|
|
|