[llvm-commits] CVS: llvm/lib/Target/X86/X86RegisterClasses.cpp X86RegisterInfo.h X86RegisterInfo.cpp
Misha Brukman
brukman at cs.uiuc.edu
Wed Nov 20 13:00:01 PST 2002
Changes in directory llvm/lib/Target/X86:
X86RegisterClasses.cpp added (r1.1)
X86RegisterInfo.h updated: 1.1 -> 1.2
X86RegisterInfo.cpp updated: 1.1 -> 1.2
---
Log message:
Add definitions for function headers from MRegisterInfo.h:
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.
---
Diffs of the changes:
Index: llvm/lib/Target/X86/X86RegisterInfo.h
diff -u llvm/lib/Target/X86/X86RegisterInfo.h:1.1 llvm/lib/Target/X86/X86RegisterInfo.h:1.2
--- llvm/lib/Target/X86/X86RegisterInfo.h:1.1 Fri Oct 25 17:55:53 2002
+++ llvm/lib/Target/X86/X86RegisterInfo.h Wed Nov 20 12:59:43 2002
@@ -9,8 +9,32 @@
#include "llvm/Target/MRegisterInfo.h"
+class Type;
+
struct X86RegisterInfo : public MRegisterInfo {
X86RegisterInfo();
+
+ MRegisterInfo::const_iterator const_regclass_begin() const;
+ MRegisterInfo::const_iterator const_regclass_end() const;
+
+ void copyReg2PCRel(MachineBasicBlock *MBB,
+ MachineBasicBlock::iterator &MBBI,
+ unsigned SrcReg, unsigned ImmOffset,
+ unsigned dataSize) const;
+
+ void copyPCRel2Reg(MachineBasicBlock *MBB,
+ MachineBasicBlock::iterator &MBBI,
+ unsigned ImmOffset, unsigned DestReg,
+ unsigned dataSize) const;
+
+ /// Returns register class appropriate for input SSA register
+ ///
+ const TargetRegisterClass *getClassForReg(unsigned Reg) const;
+
+ const TargetRegisterClass* getRegClassForType(const Type* Ty) const;
+
+ unsigned getNumRegClasses() const;
+
};
Index: llvm/lib/Target/X86/X86RegisterInfo.cpp
diff -u llvm/lib/Target/X86/X86RegisterInfo.cpp:1.1 llvm/lib/Target/X86/X86RegisterInfo.cpp:1.2
--- llvm/lib/Target/X86/X86RegisterInfo.cpp:1.1 Fri Oct 25 17:55:53 2002
+++ llvm/lib/Target/X86/X86RegisterInfo.cpp Wed Nov 20 12:59:43 2002
@@ -4,7 +4,11 @@
//
//===----------------------------------------------------------------------===//
+#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
@@ -17,3 +21,25 @@
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);
+}
+
More information about the llvm-commits
mailing list