diff options
| author | Jim Grosbach <grosbach@apple.com> | 2010-10-08 21:45:55 +0000 |
|---|---|---|
| committer | Jim Grosbach <grosbach@apple.com> | 2010-10-08 21:45:55 +0000 |
| commit | c43c930690b854b016ba667416956f96a0103204 (patch) | |
| tree | a9d9462af4931abd6cabb9b90b353c9926575fef /llvm/lib/Target/ARM/ARMMCCodeEmitter.cpp | |
| parent | 2a14088b656a99c7c4c8a5260f9472ed4cea94ad (diff) | |
| download | bcm5719-llvm-c43c930690b854b016ba667416956f96a0103204.tar.gz bcm5719-llvm-c43c930690b854b016ba667416956f96a0103204.zip | |
Implement a few more binary encoding bits. Still very early stage proof-of-
concept level stuff at this point, but it is generally working for those
instructions that know how to map the operands.
This patch fills in the register operands for add/sub/or/etc instructions
and adds the conditional execution predicate encoding.
llvm-svn: 116112
Diffstat (limited to 'llvm/lib/Target/ARM/ARMMCCodeEmitter.cpp')
| -rw-r--r-- | llvm/lib/Target/ARM/ARMMCCodeEmitter.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/llvm/lib/Target/ARM/ARMMCCodeEmitter.cpp b/llvm/lib/Target/ARM/ARMMCCodeEmitter.cpp index 1f45eb94052..fce1f3914de 100644 --- a/llvm/lib/Target/ARM/ARMMCCodeEmitter.cpp +++ b/llvm/lib/Target/ARM/ARMMCCodeEmitter.cpp @@ -106,6 +106,25 @@ EmitImmediate(const MCOperand &DispOp, unsigned Size, MCFixupKind FixupKind, assert(0 && "ARMMCCodeEmitter::EmitImmediate() not yet implemented."); } +/// getMachineOpValue - Return binary encoding of operand. If the machine +/// operand requires relocation, record the relocation and return zero. +unsigned ARMMCCodeEmitter::getMachineOpValue(const MCInst &MI, + const MCOperand &MO) const { + if (MO.isReg()) + // FIXME: Should shifted register stuff be handled as part of this? Maybe. + return getARMRegisterNumbering(MO.getReg()); + else if (MO.isImm()) + // FIXME: This is insufficient. Shifted immediates and all that... (blech). + return static_cast<unsigned>(MO.getImm()); + else { +#ifndef NDEBUG + errs() << MO; +#endif + llvm_unreachable(0); + } + return 0; +} + void ARMMCCodeEmitter:: EncodeInstruction(const MCInst &MI, raw_ostream &OS, SmallVectorImpl<MCFixup> &Fixups) const { |

