[llvm-commits] [llvm] r119118 - in /llvm/trunk/lib/Target/PowerPC: PPCInstrInfo.td PPCMCCodeEmitter.cpp
Chris Lattner
sabre at nondot.org
Sun Nov 14 20:51:56 PST 2010
Author: lattner
Date: Sun Nov 14 22:51:55 2010
New Revision: 119118
URL: http://llvm.org/viewvc/llvm-project?rev=119118&view=rev
Log:
add basic encoding support for immediates and registers, allowing us
to encode all of these instructions correctly (for example):
mflr r0 ; encoding: [0x7c,0x08,0x02,0xa6]
stw r0, 8(r1) ; encoding: [0x90,0x01,0x00,0x08]
stwu r1, -64(r1) ; encoding: [0x94,0x21,0xff,0xc0]
Modified:
llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.td
llvm/trunk/lib/Target/PowerPC/PPCMCCodeEmitter.cpp
Modified: llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.td?rev=119118&r1=119117&r2=119118&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.td (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.td Sun Nov 14 22:51:55 2010
@@ -295,9 +295,7 @@
def aaddr : Operand<iPTR> {
let PrintMethod = "printAbsAddrOperand";
}
-def piclabel: Operand<iPTR> {
- let PrintMethod = "printPICLabel";
-}
+def piclabel: Operand<iPTR> {}
def symbolHi: Operand<i32> {
let PrintMethod = "printSymbolHi";
}
@@ -321,7 +319,6 @@
let MIOperandInfo = (ops i32imm:$imm, ptr_rc:$reg);
}
def tocentry : Operand<iPTR> {
- let PrintMethod = "printTOCEntryLabel";
let MIOperandInfo = (ops i32imm:$imm);
}
Modified: llvm/trunk/lib/Target/PowerPC/PPCMCCodeEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCMCCodeEmitter.cpp?rev=119118&r1=119117&r2=119118&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCMCCodeEmitter.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCMCCodeEmitter.cpp Sun Nov 14 22:51:55 2010
@@ -13,6 +13,7 @@
#define DEBUG_TYPE "mccodeemitter"
#include "PPC.h"
+#include "PPCRegisterInfo.h"
#include "llvm/MC/MCCodeEmitter.h"
#include "llvm/MC/MCInst.h"
#include "llvm/ADT/Statistic.h"
@@ -91,6 +92,12 @@
unsigned PPCMCCodeEmitter::
getMachineOpValue(const MCInst &MI, const MCOperand &MO,
SmallVectorImpl<MCFixup> &Fixups) const {
+ if (MO.isReg())
+ return PPCRegisterInfo::getRegisterNumbering(MO.getReg());
+
+ if (MO.isImm())
+ return MO.getImm();
+
// FIXME.
return 0;
}
More information about the llvm-commits
mailing list