blob: 93e6fc76322e8b33094b9640ee3354b9aed66776 [file] [log] [blame]
Chris Lattner9ec375c2010-11-15 04:16:32 +00001//===-- PPCMCCodeEmitter.cpp - Convert PPC code to machine code -----------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file implements the PPCMCCodeEmitter class.
11//
12//===----------------------------------------------------------------------===//
13
14#define DEBUG_TYPE "mccodeemitter"
Chandler Carruthed0881b2012-12-03 16:50:05 +000015#include "MCTargetDesc/PPCMCTargetDesc.h"
Evan Cheng61d4a202011-07-25 19:53:23 +000016#include "MCTargetDesc/PPCFixupKinds.h"
Chandler Carruthed0881b2012-12-03 16:50:05 +000017#include "llvm/ADT/Statistic.h"
Chris Lattner9ec375c2010-11-15 04:16:32 +000018#include "llvm/MC/MCCodeEmitter.h"
Hal Finkelfeea6532013-03-26 20:08:20 +000019#include "llvm/MC/MCContext.h"
Bill Schmidtc56f1d32012-12-11 20:30:11 +000020#include "llvm/MC/MCExpr.h"
Chris Lattner9ec375c2010-11-15 04:16:32 +000021#include "llvm/MC/MCInst.h"
Adhemerval Zanellaf2aceda2012-10-25 12:27:42 +000022#include "llvm/MC/MCInstrInfo.h"
Chandler Carruthed0881b2012-12-03 16:50:05 +000023#include "llvm/MC/MCSubtargetInfo.h"
Chris Lattner9ec375c2010-11-15 04:16:32 +000024#include "llvm/Support/ErrorHandling.h"
Chandler Carruthed0881b2012-12-03 16:50:05 +000025#include "llvm/Support/raw_ostream.h"
Bill Schmidtc763c222013-09-16 17:25:12 +000026#include "llvm/Target/TargetOpcodes.h"
Chris Lattner9ec375c2010-11-15 04:16:32 +000027using namespace llvm;
28
29STATISTIC(MCNumEmitted, "Number of MC instructions emitted");
30
31namespace {
32class PPCMCCodeEmitter : public MCCodeEmitter {
Craig Toppera60c0f12012-09-15 17:09:36 +000033 PPCMCCodeEmitter(const PPCMCCodeEmitter &) LLVM_DELETED_FUNCTION;
34 void operator=(const PPCMCCodeEmitter &) LLVM_DELETED_FUNCTION;
35
Hal Finkela7bbaf62014-02-02 06:12:27 +000036 const MCInstrInfo &MCII;
Hal Finkelfeea6532013-03-26 20:08:20 +000037 const MCContext &CTX;
Adhemerval Zanellaf2aceda2012-10-25 12:27:42 +000038
Chris Lattner9ec375c2010-11-15 04:16:32 +000039public:
Hal Finkela7bbaf62014-02-02 06:12:27 +000040 PPCMCCodeEmitter(const MCInstrInfo &mcii, MCContext &ctx)
41 : MCII(mcii), CTX(ctx) {
Chris Lattner9ec375c2010-11-15 04:16:32 +000042 }
43
44 ~PPCMCCodeEmitter() {}
Chris Lattnerd6a07cc2010-11-15 05:19:25 +000045
Chris Lattner0e3461e2010-11-15 06:09:35 +000046 unsigned getDirectBrEncoding(const MCInst &MI, unsigned OpNo,
David Woodhouse3fa98a62014-01-28 23:13:18 +000047 SmallVectorImpl<MCFixup> &Fixups,
48 const MCSubtargetInfo &STI) const;
Chris Lattner0e3461e2010-11-15 06:09:35 +000049 unsigned getCondBrEncoding(const MCInst &MI, unsigned OpNo,
David Woodhouse3fa98a62014-01-28 23:13:18 +000050 SmallVectorImpl<MCFixup> &Fixups,
51 const MCSubtargetInfo &STI) const;
Ulrich Weigandb6a30d12013-06-24 11:03:33 +000052 unsigned getAbsDirectBrEncoding(const MCInst &MI, unsigned OpNo,
David Woodhouse3fa98a62014-01-28 23:13:18 +000053 SmallVectorImpl<MCFixup> &Fixups,
54 const MCSubtargetInfo &STI) const;
Ulrich Weigandb6a30d12013-06-24 11:03:33 +000055 unsigned getAbsCondBrEncoding(const MCInst &MI, unsigned OpNo,
David Woodhouse3fa98a62014-01-28 23:13:18 +000056 SmallVectorImpl<MCFixup> &Fixups,
57 const MCSubtargetInfo &STI) const;
Ulrich Weigandfd3ad692013-06-26 13:49:15 +000058 unsigned getImm16Encoding(const MCInst &MI, unsigned OpNo,
David Woodhouse3fa98a62014-01-28 23:13:18 +000059 SmallVectorImpl<MCFixup> &Fixups,
60 const MCSubtargetInfo &STI) const;
Chris Lattnerefacb9e2010-11-15 08:22:03 +000061 unsigned getMemRIEncoding(const MCInst &MI, unsigned OpNo,
David Woodhouse3fa98a62014-01-28 23:13:18 +000062 SmallVectorImpl<MCFixup> &Fixups,
63 const MCSubtargetInfo &STI) const;
Chris Lattner8f4444d2010-11-15 08:02:41 +000064 unsigned getMemRIXEncoding(const MCInst &MI, unsigned OpNo,
David Woodhouse3fa98a62014-01-28 23:13:18 +000065 SmallVectorImpl<MCFixup> &Fixups,
66 const MCSubtargetInfo &STI) const;
Bill Schmidtca4a0c92012-12-04 16:18:08 +000067 unsigned getTLSRegEncoding(const MCInst &MI, unsigned OpNo,
David Woodhouse3fa98a62014-01-28 23:13:18 +000068 SmallVectorImpl<MCFixup> &Fixups,
69 const MCSubtargetInfo &STI) const;
Ulrich Weigand5143bab2013-07-02 21:31:04 +000070 unsigned getTLSCallEncoding(const MCInst &MI, unsigned OpNo,
David Woodhouse3fa98a62014-01-28 23:13:18 +000071 SmallVectorImpl<MCFixup> &Fixups,
72 const MCSubtargetInfo &STI) const;
Chris Lattnerd6a07cc2010-11-15 05:19:25 +000073 unsigned get_crbitm_encoding(const MCInst &MI, unsigned OpNo,
David Woodhouse3fa98a62014-01-28 23:13:18 +000074 SmallVectorImpl<MCFixup> &Fixups,
75 const MCSubtargetInfo &STI) const;
Chris Lattnerd6a07cc2010-11-15 05:19:25 +000076
Chris Lattner9ec375c2010-11-15 04:16:32 +000077 /// getMachineOpValue - Return binary encoding of operand. If the machine
78 /// operand requires relocation, record the relocation and return zero.
79 unsigned getMachineOpValue(const MCInst &MI,const MCOperand &MO,
David Woodhouse3fa98a62014-01-28 23:13:18 +000080 SmallVectorImpl<MCFixup> &Fixups,
81 const MCSubtargetInfo &STI) const;
Chris Lattner9ec375c2010-11-15 04:16:32 +000082
83 // getBinaryCodeForInstr - TableGen'erated function for getting the
84 // binary encoding for an instruction.
Owen Andersond845d9d2012-01-24 18:37:29 +000085 uint64_t getBinaryCodeForInstr(const MCInst &MI,
David Woodhouse3fa98a62014-01-28 23:13:18 +000086 SmallVectorImpl<MCFixup> &Fixups,
87 const MCSubtargetInfo &STI) const;
Chris Lattner9ec375c2010-11-15 04:16:32 +000088 void EncodeInstruction(const MCInst &MI, raw_ostream &OS,
David Woodhouse9784cef2014-01-28 23:13:07 +000089 SmallVectorImpl<MCFixup> &Fixups,
90 const MCSubtargetInfo &STI) const {
Bill Schmidtc763c222013-09-16 17:25:12 +000091 // For fast-isel, a float COPY_TO_REGCLASS can survive this long.
92 // It's just a nop to keep the register classes happy, so don't
93 // generate anything.
94 unsigned Opcode = MI.getOpcode();
Hal Finkela7bbaf62014-02-02 06:12:27 +000095 const MCInstrDesc &Desc = MCII.get(Opcode);
Bill Schmidtc763c222013-09-16 17:25:12 +000096 if (Opcode == TargetOpcode::COPY_TO_REGCLASS)
97 return;
98
David Woodhouse3fa98a62014-01-28 23:13:18 +000099 uint64_t Bits = getBinaryCodeForInstr(MI, Fixups, STI);
Adhemerval Zanella1be10dc2012-10-25 14:29:13 +0000100
Chris Lattner9ec375c2010-11-15 04:16:32 +0000101 // Output the constant in big endian byte order.
Hal Finkela7bbaf62014-02-02 06:12:27 +0000102 unsigned Size = Desc.getSize();
Adhemerval Zanella1be10dc2012-10-25 14:29:13 +0000103 int ShiftValue = (Size * 8) - 8;
104 for (unsigned i = 0; i != Size; ++i) {
105 OS << (char)(Bits >> ShiftValue);
Chris Lattner9ec375c2010-11-15 04:16:32 +0000106 Bits <<= 8;
107 }
108
109 ++MCNumEmitted; // Keep track of the # of mi's emitted.
110 }
111
112};
113
114} // end anonymous namespace
115
Evan Chengc5e6d2f2011-07-11 03:57:24 +0000116MCCodeEmitter *llvm::createPPCMCCodeEmitter(const MCInstrInfo &MCII,
Jim Grosbachc3b04272012-05-15 17:35:52 +0000117 const MCRegisterInfo &MRI,
Evan Chengc5e6d2f2011-07-11 03:57:24 +0000118 const MCSubtargetInfo &STI,
Chris Lattner9ec375c2010-11-15 04:16:32 +0000119 MCContext &Ctx) {
David Woodhoused2cca112014-01-28 23:13:25 +0000120 return new PPCMCCodeEmitter(MCII, Ctx);
Chris Lattner9ec375c2010-11-15 04:16:32 +0000121}
122
123unsigned PPCMCCodeEmitter::
Chris Lattner0e3461e2010-11-15 06:09:35 +0000124getDirectBrEncoding(const MCInst &MI, unsigned OpNo,
David Woodhouse3fa98a62014-01-28 23:13:18 +0000125 SmallVectorImpl<MCFixup> &Fixups,
126 const MCSubtargetInfo &STI) const {
Chris Lattner79fa3712010-11-15 05:57:53 +0000127 const MCOperand &MO = MI.getOperand(OpNo);
David Woodhouse3fa98a62014-01-28 23:13:18 +0000128 if (MO.isReg() || MO.isImm()) return getMachineOpValue(MI, MO, Fixups, STI);
Chris Lattner79fa3712010-11-15 05:57:53 +0000129
130 // Add a fixup for the branch target.
131 Fixups.push_back(MCFixup::Create(0, MO.getExpr(),
132 (MCFixupKind)PPC::fixup_ppc_br24));
133 return 0;
134}
135
Chris Lattner0e3461e2010-11-15 06:09:35 +0000136unsigned PPCMCCodeEmitter::getCondBrEncoding(const MCInst &MI, unsigned OpNo,
David Woodhouse3fa98a62014-01-28 23:13:18 +0000137 SmallVectorImpl<MCFixup> &Fixups,
138 const MCSubtargetInfo &STI) const {
Chris Lattner0e3461e2010-11-15 06:09:35 +0000139 const MCOperand &MO = MI.getOperand(OpNo);
David Woodhouse3fa98a62014-01-28 23:13:18 +0000140 if (MO.isReg() || MO.isImm()) return getMachineOpValue(MI, MO, Fixups, STI);
Chris Lattner0e3461e2010-11-15 06:09:35 +0000141
Chris Lattner85e37682010-11-15 06:12:22 +0000142 // Add a fixup for the branch target.
143 Fixups.push_back(MCFixup::Create(0, MO.getExpr(),
144 (MCFixupKind)PPC::fixup_ppc_brcond14));
Chris Lattner0e3461e2010-11-15 06:09:35 +0000145 return 0;
146}
147
Ulrich Weigandb6a30d12013-06-24 11:03:33 +0000148unsigned PPCMCCodeEmitter::
149getAbsDirectBrEncoding(const MCInst &MI, unsigned OpNo,
David Woodhouse3fa98a62014-01-28 23:13:18 +0000150 SmallVectorImpl<MCFixup> &Fixups,
151 const MCSubtargetInfo &STI) const {
Ulrich Weigandb6a30d12013-06-24 11:03:33 +0000152 const MCOperand &MO = MI.getOperand(OpNo);
David Woodhouse3fa98a62014-01-28 23:13:18 +0000153 if (MO.isReg() || MO.isImm()) return getMachineOpValue(MI, MO, Fixups, STI);
Ulrich Weigandb6a30d12013-06-24 11:03:33 +0000154
155 // Add a fixup for the branch target.
156 Fixups.push_back(MCFixup::Create(0, MO.getExpr(),
157 (MCFixupKind)PPC::fixup_ppc_br24abs));
158 return 0;
159}
160
161unsigned PPCMCCodeEmitter::
162getAbsCondBrEncoding(const MCInst &MI, unsigned OpNo,
David Woodhouse3fa98a62014-01-28 23:13:18 +0000163 SmallVectorImpl<MCFixup> &Fixups,
164 const MCSubtargetInfo &STI) const {
Ulrich Weigandb6a30d12013-06-24 11:03:33 +0000165 const MCOperand &MO = MI.getOperand(OpNo);
David Woodhouse3fa98a62014-01-28 23:13:18 +0000166 if (MO.isReg() || MO.isImm()) return getMachineOpValue(MI, MO, Fixups, STI);
Ulrich Weigandb6a30d12013-06-24 11:03:33 +0000167
168 // Add a fixup for the branch target.
169 Fixups.push_back(MCFixup::Create(0, MO.getExpr(),
170 (MCFixupKind)PPC::fixup_ppc_brcond14abs));
171 return 0;
172}
173
Ulrich Weigandfd3ad692013-06-26 13:49:15 +0000174unsigned PPCMCCodeEmitter::getImm16Encoding(const MCInst &MI, unsigned OpNo,
David Woodhouse3fa98a62014-01-28 23:13:18 +0000175 SmallVectorImpl<MCFixup> &Fixups,
176 const MCSubtargetInfo &STI) const {
Chris Lattner65661122010-11-15 06:33:39 +0000177 const MCOperand &MO = MI.getOperand(OpNo);
David Woodhouse3fa98a62014-01-28 23:13:18 +0000178 if (MO.isReg() || MO.isImm()) return getMachineOpValue(MI, MO, Fixups, STI);
Chris Lattner65661122010-11-15 06:33:39 +0000179
Ulrich Weigandfd3ad692013-06-26 13:49:15 +0000180 // Add a fixup for the immediate field.
Ulrich Weigand2fb140e2013-05-15 15:07:06 +0000181 Fixups.push_back(MCFixup::Create(2, MO.getExpr(),
Ulrich Weigand6e23ac62013-05-17 12:37:21 +0000182 (MCFixupKind)PPC::fixup_ppc_half16));
Chris Lattner65661122010-11-15 06:33:39 +0000183 return 0;
184}
185
Chris Lattnerefacb9e2010-11-15 08:22:03 +0000186unsigned PPCMCCodeEmitter::getMemRIEncoding(const MCInst &MI, unsigned OpNo,
David Woodhouse3fa98a62014-01-28 23:13:18 +0000187 SmallVectorImpl<MCFixup> &Fixups,
188 const MCSubtargetInfo &STI) const {
Chris Lattnerefacb9e2010-11-15 08:22:03 +0000189 // Encode (imm, reg) as a memri, which has the low 16-bits as the
190 // displacement and the next 5 bits as the register #.
191 assert(MI.getOperand(OpNo+1).isReg());
David Woodhouse3fa98a62014-01-28 23:13:18 +0000192 unsigned RegBits = getMachineOpValue(MI, MI.getOperand(OpNo+1), Fixups, STI) << 16;
Chris Lattnerefacb9e2010-11-15 08:22:03 +0000193
194 const MCOperand &MO = MI.getOperand(OpNo);
195 if (MO.isImm())
David Woodhouse3fa98a62014-01-28 23:13:18 +0000196 return (getMachineOpValue(MI, MO, Fixups, STI) & 0xFFFF) | RegBits;
Chris Lattnerefacb9e2010-11-15 08:22:03 +0000197
198 // Add a fixup for the displacement field.
Ulrich Weigand2fb140e2013-05-15 15:07:06 +0000199 Fixups.push_back(MCFixup::Create(2, MO.getExpr(),
Ulrich Weigand6e23ac62013-05-17 12:37:21 +0000200 (MCFixupKind)PPC::fixup_ppc_half16));
Chris Lattnerefacb9e2010-11-15 08:22:03 +0000201 return RegBits;
202}
203
204
Chris Lattner8f4444d2010-11-15 08:02:41 +0000205unsigned PPCMCCodeEmitter::getMemRIXEncoding(const MCInst &MI, unsigned OpNo,
David Woodhouse3fa98a62014-01-28 23:13:18 +0000206 SmallVectorImpl<MCFixup> &Fixups,
207 const MCSubtargetInfo &STI) const {
Chris Lattner8f4444d2010-11-15 08:02:41 +0000208 // Encode (imm, reg) as a memrix, which has the low 14-bits as the
209 // displacement and the next 5 bits as the register #.
Chris Lattnerefacb9e2010-11-15 08:22:03 +0000210 assert(MI.getOperand(OpNo+1).isReg());
David Woodhouse3fa98a62014-01-28 23:13:18 +0000211 unsigned RegBits = getMachineOpValue(MI, MI.getOperand(OpNo+1), Fixups, STI) << 14;
Chris Lattner8f4444d2010-11-15 08:02:41 +0000212
Chris Lattner65661122010-11-15 06:33:39 +0000213 const MCOperand &MO = MI.getOperand(OpNo);
Chris Lattner8f4444d2010-11-15 08:02:41 +0000214 if (MO.isImm())
David Woodhouse3fa98a62014-01-28 23:13:18 +0000215 return ((getMachineOpValue(MI, MO, Fixups, STI) >> 2) & 0x3FFF) | RegBits;
Chris Lattner65661122010-11-15 06:33:39 +0000216
Ulrich Weigand3e186012013-03-26 10:56:47 +0000217 // Add a fixup for the displacement field.
Ulrich Weigand2fb140e2013-05-15 15:07:06 +0000218 Fixups.push_back(MCFixup::Create(2, MO.getExpr(),
Ulrich Weigand6e23ac62013-05-17 12:37:21 +0000219 (MCFixupKind)PPC::fixup_ppc_half16ds));
Chris Lattner8f4444d2010-11-15 08:02:41 +0000220 return RegBits;
Chris Lattner65661122010-11-15 06:33:39 +0000221}
222
Chris Lattner0e3461e2010-11-15 06:09:35 +0000223
Bill Schmidtca4a0c92012-12-04 16:18:08 +0000224unsigned PPCMCCodeEmitter::getTLSRegEncoding(const MCInst &MI, unsigned OpNo,
David Woodhouse3fa98a62014-01-28 23:13:18 +0000225 SmallVectorImpl<MCFixup> &Fixups,
226 const MCSubtargetInfo &STI) const {
Bill Schmidtca4a0c92012-12-04 16:18:08 +0000227 const MCOperand &MO = MI.getOperand(OpNo);
David Woodhouse3fa98a62014-01-28 23:13:18 +0000228 if (MO.isReg()) return getMachineOpValue(MI, MO, Fixups, STI);
Bill Schmidtca4a0c92012-12-04 16:18:08 +0000229
230 // Add a fixup for the TLS register, which simply provides a relocation
231 // hint to the linker that this statement is part of a relocation sequence.
232 // Return the thread-pointer register's encoding.
233 Fixups.push_back(MCFixup::Create(0, MO.getExpr(),
Ulrich Weigand5b427592013-07-05 12:22:36 +0000234 (MCFixupKind)PPC::fixup_ppc_nofixup));
David Woodhoused2cca112014-01-28 23:13:25 +0000235 Triple TT(STI.getTargetTriple());
Roman Divackybc1655b42013-12-22 10:45:37 +0000236 bool isPPC64 = TT.getArch() == Triple::ppc64 || TT.getArch() == Triple::ppc64le;
237 return CTX.getRegisterInfo()->getEncodingValue(isPPC64 ? PPC::X13 : PPC::R2);
Bill Schmidtca4a0c92012-12-04 16:18:08 +0000238}
239
Ulrich Weigand5143bab2013-07-02 21:31:04 +0000240unsigned PPCMCCodeEmitter::getTLSCallEncoding(const MCInst &MI, unsigned OpNo,
David Woodhouse3fa98a62014-01-28 23:13:18 +0000241 SmallVectorImpl<MCFixup> &Fixups,
242 const MCSubtargetInfo &STI) const {
Ulrich Weigand5143bab2013-07-02 21:31:04 +0000243 // For special TLS calls, we need two fixups; one for the branch target
244 // (__tls_get_addr), which we create via getDirectBrEncoding as usual,
245 // and one for the TLSGD or TLSLD symbol, which is emitted here.
246 const MCOperand &MO = MI.getOperand(OpNo+1);
247 Fixups.push_back(MCFixup::Create(0, MO.getExpr(),
248 (MCFixupKind)PPC::fixup_ppc_nofixup));
David Woodhouse3fa98a62014-01-28 23:13:18 +0000249 return getDirectBrEncoding(MI, OpNo, Fixups, STI);
Ulrich Weigand5143bab2013-07-02 21:31:04 +0000250}
251
Chris Lattner79fa3712010-11-15 05:57:53 +0000252unsigned PPCMCCodeEmitter::
Chris Lattnerd6a07cc2010-11-15 05:19:25 +0000253get_crbitm_encoding(const MCInst &MI, unsigned OpNo,
David Woodhouse3fa98a62014-01-28 23:13:18 +0000254 SmallVectorImpl<MCFixup> &Fixups,
255 const MCSubtargetInfo &STI) const {
Chris Lattnerd6a07cc2010-11-15 05:19:25 +0000256 const MCOperand &MO = MI.getOperand(OpNo);
Ulrich Weigand49f487e2013-07-03 17:59:07 +0000257 assert((MI.getOpcode() == PPC::MTOCRF || MI.getOpcode() == PPC::MTOCRF8 ||
Ulrich Weigandd5ebc622013-07-03 17:05:42 +0000258 MI.getOpcode() == PPC::MFOCRF || MI.getOpcode() == PPC::MFOCRF8) &&
Chris Lattnerd6a07cc2010-11-15 05:19:25 +0000259 (MO.getReg() >= PPC::CR0 && MO.getReg() <= PPC::CR7));
Bill Wendlingbc07a892013-06-18 07:20:20 +0000260 return 0x80 >> CTX.getRegisterInfo()->getEncodingValue(MO.getReg());
Chris Lattnerd6a07cc2010-11-15 05:19:25 +0000261}
262
263
264unsigned PPCMCCodeEmitter::
Chris Lattner9ec375c2010-11-15 04:16:32 +0000265getMachineOpValue(const MCInst &MI, const MCOperand &MO,
David Woodhouse3fa98a62014-01-28 23:13:18 +0000266 SmallVectorImpl<MCFixup> &Fixups,
267 const MCSubtargetInfo &STI) const {
Chris Lattnerd6a07cc2010-11-15 05:19:25 +0000268 if (MO.isReg()) {
Ulrich Weigand49f487e2013-07-03 17:59:07 +0000269 // MTOCRF/MFOCRF should go through get_crbitm_encoding for the CR operand.
Chris Lattner7b25d6f2010-11-16 00:57:32 +0000270 // The GPR operand should come through here though.
Ulrich Weigand49f487e2013-07-03 17:59:07 +0000271 assert((MI.getOpcode() != PPC::MTOCRF && MI.getOpcode() != PPC::MTOCRF8 &&
Ulrich Weigandd5ebc622013-07-03 17:05:42 +0000272 MI.getOpcode() != PPC::MFOCRF && MI.getOpcode() != PPC::MFOCRF8) ||
Chris Lattner73716a62010-11-16 00:55:51 +0000273 MO.getReg() < PPC::CR0 || MO.getReg() > PPC::CR7);
Bill Wendlingbc07a892013-06-18 07:20:20 +0000274 return CTX.getRegisterInfo()->getEncodingValue(MO.getReg());
Chris Lattnerd6a07cc2010-11-15 05:19:25 +0000275 }
Chris Lattnerc877d8f2010-11-15 04:51:55 +0000276
Chris Lattnerefacb9e2010-11-15 08:22:03 +0000277 assert(MO.isImm() &&
278 "Relocation required in an instruction that we cannot encode!");
279 return MO.getImm();
Chris Lattner9ec375c2010-11-15 04:16:32 +0000280}
281
282
283#include "PPCGenMCCodeEmitter.inc"