mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-21 19:32:16 +00:00
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] git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119118 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a2d602529d
commit
a04084e777
@ -295,9 +295,7 @@ def calltarget : Operand<iPTR> {
|
|||||||
def aaddr : Operand<iPTR> {
|
def aaddr : Operand<iPTR> {
|
||||||
let PrintMethod = "printAbsAddrOperand";
|
let PrintMethod = "printAbsAddrOperand";
|
||||||
}
|
}
|
||||||
def piclabel: Operand<iPTR> {
|
def piclabel: Operand<iPTR> {}
|
||||||
let PrintMethod = "printPICLabel";
|
|
||||||
}
|
|
||||||
def symbolHi: Operand<i32> {
|
def symbolHi: Operand<i32> {
|
||||||
let PrintMethod = "printSymbolHi";
|
let PrintMethod = "printSymbolHi";
|
||||||
}
|
}
|
||||||
@ -321,7 +319,6 @@ def memrix : Operand<iPTR> { // memri where the imm is shifted 2 bits.
|
|||||||
let MIOperandInfo = (ops i32imm:$imm, ptr_rc:$reg);
|
let MIOperandInfo = (ops i32imm:$imm, ptr_rc:$reg);
|
||||||
}
|
}
|
||||||
def tocentry : Operand<iPTR> {
|
def tocentry : Operand<iPTR> {
|
||||||
let PrintMethod = "printTOCEntryLabel";
|
|
||||||
let MIOperandInfo = (ops i32imm:$imm);
|
let MIOperandInfo = (ops i32imm:$imm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
#define DEBUG_TYPE "mccodeemitter"
|
#define DEBUG_TYPE "mccodeemitter"
|
||||||
#include "PPC.h"
|
#include "PPC.h"
|
||||||
|
#include "PPCRegisterInfo.h"
|
||||||
#include "llvm/MC/MCCodeEmitter.h"
|
#include "llvm/MC/MCCodeEmitter.h"
|
||||||
#include "llvm/MC/MCInst.h"
|
#include "llvm/MC/MCInst.h"
|
||||||
#include "llvm/ADT/Statistic.h"
|
#include "llvm/ADT/Statistic.h"
|
||||||
@ -91,6 +92,12 @@ MCCodeEmitter *llvm::createPPCMCCodeEmitter(const Target &, TargetMachine &TM,
|
|||||||
unsigned PPCMCCodeEmitter::
|
unsigned PPCMCCodeEmitter::
|
||||||
getMachineOpValue(const MCInst &MI, const MCOperand &MO,
|
getMachineOpValue(const MCInst &MI, const MCOperand &MO,
|
||||||
SmallVectorImpl<MCFixup> &Fixups) const {
|
SmallVectorImpl<MCFixup> &Fixups) const {
|
||||||
|
if (MO.isReg())
|
||||||
|
return PPCRegisterInfo::getRegisterNumbering(MO.getReg());
|
||||||
|
|
||||||
|
if (MO.isImm())
|
||||||
|
return MO.getImm();
|
||||||
|
|
||||||
// FIXME.
|
// FIXME.
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user