blob: 25ce9c7365ca05a42c9af70df61710b6024dc250 [file] [log] [blame]
Jia Liu9f610112012-02-17 08:55:11 +00001//===-- MipsASMBackend.cpp - Mips Asm Backend ----------------------------===//
Bruno Cardoso Lopesc85e3ff2011-11-11 22:58:42 +00002//
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 MipsAsmBackend and MipsELFObjectWriter classes.
11//
12//===----------------------------------------------------------------------===//
13//
14
15#include "MipsFixupKinds.h"
Akira Hatanaka587fe6c2011-09-30 21:04:02 +000016#include "MCTargetDesc/MipsMCTargetDesc.h"
Bruno Cardoso Lopesc85e3ff2011-11-11 22:58:42 +000017#include "llvm/MC/MCAsmBackend.h"
Akira Hatanaka587fe6c2011-09-30 21:04:02 +000018#include "llvm/MC/MCAssembler.h"
Matheus Almeidae0d75aa2013-12-13 11:11:02 +000019#include "llvm/MC/MCContext.h"
Akira Hatanaka587fe6c2011-09-30 21:04:02 +000020#include "llvm/MC/MCDirectives.h"
21#include "llvm/MC/MCELFObjectWriter.h"
Craig Topper6e80c282012-03-26 06:58:25 +000022#include "llvm/MC/MCFixupKindInfo.h"
Akira Hatanaka587fe6c2011-09-30 21:04:02 +000023#include "llvm/MC/MCObjectWriter.h"
Akira Hatanaka587fe6c2011-09-30 21:04:02 +000024#include "llvm/MC/MCSubtargetInfo.h"
Akira Hatanaka587fe6c2011-09-30 21:04:02 +000025#include "llvm/Support/ErrorHandling.h"
26#include "llvm/Support/raw_ostream.h"
Matheus Almeidae0d75aa2013-12-13 11:11:02 +000027#include "llvm/Support/MathExtras.h"
Bruno Cardoso Lopes61e6d982011-12-07 00:28:57 +000028
Akira Hatanaka587fe6c2011-09-30 21:04:02 +000029using namespace llvm;
30
Bruno Cardoso Lopes61e6d982011-12-07 00:28:57 +000031// Prepare value for the target space for it
Matheus Almeidae0d75aa2013-12-13 11:11:02 +000032static unsigned adjustFixupValue(const MCFixup &Fixup, uint64_t Value,
33 MCContext *Ctx = NULL) {
34
35 unsigned Kind = Fixup.getKind();
Bruno Cardoso Lopesc85e3ff2011-11-11 22:58:42 +000036
37 // Add/subtract and shift
38 switch (Kind) {
39 default:
Bruno Cardoso Lopes61e6d982011-12-07 00:28:57 +000040 return 0;
41 case FK_GPRel_4:
42 case FK_Data_4:
Jack Carter4c583812012-08-07 00:01:14 +000043 case FK_Data_8:
Bruno Cardoso Lopes61e6d982011-12-07 00:28:57 +000044 case Mips::fixup_Mips_LO16:
Jack Carterc3dd91c2013-01-08 19:01:28 +000045 case Mips::fixup_Mips_GPREL16:
Jack Carterb9f9de92012-06-27 22:48:25 +000046 case Mips::fixup_Mips_GPOFF_HI:
47 case Mips::fixup_Mips_GPOFF_LO:
48 case Mips::fixup_Mips_GOT_PAGE:
49 case Mips::fixup_Mips_GOT_OFST:
Jack Carter5ddcfda2012-07-13 19:15:47 +000050 case Mips::fixup_Mips_GOT_DISP:
Jack Carterb05cb672012-11-21 23:38:59 +000051 case Mips::fixup_Mips_GOT_LO16:
52 case Mips::fixup_Mips_CALL_LO16:
Zoran Jovanovice7ae8af2013-10-23 16:14:44 +000053 case Mips::fixup_MICROMIPS_LO16:
54 case Mips::fixup_MICROMIPS_GOT_PAGE:
55 case Mips::fixup_MICROMIPS_GOT_OFST:
56 case Mips::fixup_MICROMIPS_GOT_DISP:
Bruno Cardoso Lopesc85e3ff2011-11-11 22:58:42 +000057 break;
58 case Mips::fixup_Mips_PC16:
59 // So far we are only using this type for branches.
60 // For branches we start 1 instruction after the branch
61 // so the displacement will be one instruction size less.
62 Value -= 4;
63 // The displacement is then divided by 4 to give us an 18 bit
Matheus Almeidae0d75aa2013-12-13 11:11:02 +000064 // address range. Forcing a signed division because Value can be negative.
65 Value = (int64_t)Value / 4;
66 // We now check if Value can be encoded as a 16-bit signed immediate.
Matheus Almeida8cc8b352013-12-17 17:10:00 +000067 if (!isIntN(16, Value) && Ctx)
Matheus Almeidae0d75aa2013-12-13 11:11:02 +000068 Ctx->FatalError(Fixup.getLoc(), "out of range PC16 fixup");
Bruno Cardoso Lopesc85e3ff2011-11-11 22:58:42 +000069 break;
70 case Mips::fixup_Mips_26:
71 // So far we are only using this type for jumps.
72 // The displacement is then divided by 4 to give us an 28 bit
73 // address range.
74 Value >>= 2;
75 break;
Akira Hatanakaf5ddf132011-11-23 22:18:04 +000076 case Mips::fixup_Mips_HI16:
Bruno Cardoso Lopes61e6d982011-12-07 00:28:57 +000077 case Mips::fixup_Mips_GOT_Local:
Jack Carterb05cb672012-11-21 23:38:59 +000078 case Mips::fixup_Mips_GOT_HI16:
79 case Mips::fixup_Mips_CALL_HI16:
Zoran Jovanovice7ae8af2013-10-23 16:14:44 +000080 case Mips::fixup_MICROMIPS_HI16:
Jack Carter84491ab2012-08-06 21:26:03 +000081 // Get the 2nd 16-bits. Also add 1 if bit 15 is 1.
Akira Hatanakada728192012-03-27 01:50:08 +000082 Value = ((Value + 0x8000) >> 16) & 0xffff;
Akira Hatanakaf5ddf132011-11-23 22:18:04 +000083 break;
Jack Carter84491ab2012-08-06 21:26:03 +000084 case Mips::fixup_Mips_HIGHER:
85 // Get the 3rd 16-bits.
86 Value = ((Value + 0x80008000LL) >> 32) & 0xffff;
87 break;
88 case Mips::fixup_Mips_HIGHEST:
89 // Get the 4th 16-bits.
90 Value = ((Value + 0x800080008000LL) >> 48) & 0xffff;
91 break;
Zoran Jovanovic507e0842013-10-29 16:38:59 +000092 case Mips::fixup_MICROMIPS_26_S1:
93 Value >>= 1;
94 break;
Zoran Jovanovic8a80aa72013-11-04 14:53:22 +000095 case Mips::fixup_MICROMIPS_PC16_S1:
96 Value -= 4;
Matheus Almeidae0d75aa2013-12-13 11:11:02 +000097 // Forcing a signed division because Value can be negative.
98 Value = (int64_t)Value / 2;
99 // We now check if Value can be encoded as a 16-bit signed immediate.
Matheus Almeida8cc8b352013-12-17 17:10:00 +0000100 if (!isIntN(16, Value) && Ctx)
Matheus Almeidae0d75aa2013-12-13 11:11:02 +0000101 Ctx->FatalError(Fixup.getLoc(), "out of range PC16 fixup");
Zoran Jovanovic8a80aa72013-11-04 14:53:22 +0000102 break;
Bruno Cardoso Lopesc85e3ff2011-11-11 22:58:42 +0000103 }
104
105 return Value;
106}
107
Akira Hatanaka587fe6c2011-09-30 21:04:02 +0000108namespace {
Akira Hatanaka587fe6c2011-09-30 21:04:02 +0000109class MipsAsmBackend : public MCAsmBackend {
Akira Hatanaka1ee768d2012-03-01 01:53:15 +0000110 Triple::OSType OSType;
111 bool IsLittle; // Big or little endian
Akira Hatanakab1f68f92012-04-02 19:25:22 +0000112 bool Is64Bit; // 32 or 64 bit words
Akira Hatanaka1ee768d2012-03-01 01:53:15 +0000113
Akira Hatanaka587fe6c2011-09-30 21:04:02 +0000114public:
Akira Hatanakab1f68f92012-04-02 19:25:22 +0000115 MipsAsmBackend(const Target &T, Triple::OSType _OSType,
116 bool _isLittle, bool _is64Bit)
117 :MCAsmBackend(), OSType(_OSType), IsLittle(_isLittle), Is64Bit(_is64Bit) {}
Akira Hatanaka1ee768d2012-03-01 01:53:15 +0000118
119 MCObjectWriter *createObjectWriter(raw_ostream &OS) const {
Jack Carter06de0fb2012-07-02 20:04:43 +0000120 return createMipsELFObjectWriter(OS,
121 MCELFObjectTargetWriter::getOSABI(OSType), IsLittle, Is64Bit);
Akira Hatanaka1ee768d2012-03-01 01:53:15 +0000122 }
Akira Hatanaka44220ca2011-09-30 21:23:45 +0000123
Dmitri Gribenko5485acd2012-09-14 14:57:36 +0000124 /// ApplyFixup - Apply the \p Value for given \p Fixup into the provided
Akira Hatanaka44220ca2011-09-30 21:23:45 +0000125 /// data fragment, at the offset specified by the fixup and following the
126 /// fixup kind as appropriate.
Jim Grosbachaba3de92012-01-18 18:52:16 +0000127 void applyFixup(const MCFixup &Fixup, char *Data, unsigned DataSize,
Akira Hatanaka44220ca2011-09-30 21:23:45 +0000128 uint64_t Value) const {
Bruno Cardoso Lopes61e6d982011-12-07 00:28:57 +0000129 MCFixupKind Kind = Fixup.getKind();
Matheus Almeidae0d75aa2013-12-13 11:11:02 +0000130 Value = adjustFixupValue(Fixup, Value);
Bruno Cardoso Lopesc85e3ff2011-11-11 22:58:42 +0000131
Akira Hatanaka3e9d81f2012-04-16 18:00:19 +0000132 if (!Value)
Bruno Cardoso Lopes61e6d982011-12-07 00:28:57 +0000133 return; // Doesn't change encoding.
Bruno Cardoso Lopesc85e3ff2011-11-11 22:58:42 +0000134
Akira Hatanaka0137dfe2012-03-21 00:52:01 +0000135 // Where do we start in the object
Bruno Cardoso Lopesc85e3ff2011-11-11 22:58:42 +0000136 unsigned Offset = Fixup.getOffset();
Akira Hatanaka0137dfe2012-03-21 00:52:01 +0000137 // Number of bytes we need to fixup
138 unsigned NumBytes = (getFixupKindInfo(Kind).TargetSize + 7) / 8;
139 // Used to point to big endian bytes
140 unsigned FullSize;
141
Craig Topper344e0122012-03-21 02:28:53 +0000142 switch ((unsigned)Kind) {
Akira Hatanaka0137dfe2012-03-21 00:52:01 +0000143 case Mips::fixup_Mips_16:
144 FullSize = 2;
145 break;
146 case Mips::fixup_Mips_64:
147 FullSize = 8;
148 break;
149 default:
150 FullSize = 4;
151 break;
152 }
Bruno Cardoso Lopes61e6d982011-12-07 00:28:57 +0000153
154 // Grab current value, if any, from bits.
155 uint64_t CurVal = 0;
Bruno Cardoso Lopes61e6d982011-12-07 00:28:57 +0000156
Akira Hatanaka0137dfe2012-03-21 00:52:01 +0000157 for (unsigned i = 0; i != NumBytes; ++i) {
158 unsigned Idx = IsLittle ? i : (FullSize - 1 - i);
159 CurVal |= (uint64_t)((uint8_t)Data[Offset + Idx]) << (i*8);
160 }
161
Akira Hatanaka5fd22482012-06-14 21:10:56 +0000162 uint64_t Mask = ((uint64_t)(-1) >>
163 (64 - getFixupKindInfo(Kind).TargetSize));
Akira Hatanaka3e9d81f2012-04-16 18:00:19 +0000164 CurVal |= Value & Mask;
Bruno Cardoso Lopes61e6d982011-12-07 00:28:57 +0000165
Akira Hatanaka0137dfe2012-03-21 00:52:01 +0000166 // Write out the fixed up bytes back to the code/data bits.
Bruno Cardoso Lopes61e6d982011-12-07 00:28:57 +0000167 for (unsigned i = 0; i != NumBytes; ++i) {
Akira Hatanaka0137dfe2012-03-21 00:52:01 +0000168 unsigned Idx = IsLittle ? i : (FullSize - 1 - i);
169 Data[Offset + Idx] = (uint8_t)((CurVal >> (i*8)) & 0xff);
Bruno Cardoso Lopesc85e3ff2011-11-11 22:58:42 +0000170 }
Akira Hatanaka0137dfe2012-03-21 00:52:01 +0000171 }
Bruno Cardoso Lopesc85e3ff2011-11-11 22:58:42 +0000172
173 unsigned getNumFixupKinds() const { return Mips::NumTargetFixupKinds; }
174
175 const MCFixupKindInfo &getFixupKindInfo(MCFixupKind Kind) const {
176 const static MCFixupKindInfo Infos[Mips::NumTargetFixupKinds] = {
Bruno Cardoso Lopes61e6d982011-12-07 00:28:57 +0000177 // This table *must* be in same the order of fixup_* kinds in
Bruno Cardoso Lopesc85e3ff2011-11-11 22:58:42 +0000178 // MipsFixupKinds.h.
179 //
180 // name offset bits flags
Bruno Cardoso Lopesc85e3ff2011-11-11 22:58:42 +0000181 { "fixup_Mips_16", 0, 16, 0 },
182 { "fixup_Mips_32", 0, 32, 0 },
183 { "fixup_Mips_REL32", 0, 32, 0 },
184 { "fixup_Mips_26", 0, 26, 0 },
185 { "fixup_Mips_HI16", 0, 16, 0 },
186 { "fixup_Mips_LO16", 0, 16, 0 },
187 { "fixup_Mips_GPREL16", 0, 16, 0 },
188 { "fixup_Mips_LITERAL", 0, 16, 0 },
Bruno Cardoso Lopes61e6d982011-12-07 00:28:57 +0000189 { "fixup_Mips_GOT_Global", 0, 16, 0 },
190 { "fixup_Mips_GOT_Local", 0, 16, 0 },
Bruno Cardoso Lopesc85e3ff2011-11-11 22:58:42 +0000191 { "fixup_Mips_PC16", 0, 16, MCFixupKindInfo::FKF_IsPCRel },
192 { "fixup_Mips_CALL16", 0, 16, 0 },
193 { "fixup_Mips_GPREL32", 0, 32, 0 },
194 { "fixup_Mips_SHIFT5", 6, 5, 0 },
195 { "fixup_Mips_SHIFT6", 6, 5, 0 },
196 { "fixup_Mips_64", 0, 64, 0 },
197 { "fixup_Mips_TLSGD", 0, 16, 0 },
198 { "fixup_Mips_GOTTPREL", 0, 16, 0 },
199 { "fixup_Mips_TPREL_HI", 0, 16, 0 },
200 { "fixup_Mips_TPREL_LO", 0, 16, 0 },
Akira Hatanakae2eed962011-12-22 01:05:17 +0000201 { "fixup_Mips_TLSLDM", 0, 16, 0 },
202 { "fixup_Mips_DTPREL_HI", 0, 16, 0 },
203 { "fixup_Mips_DTPREL_LO", 0, 16, 0 },
Jack Carterb9f9de92012-06-27 22:48:25 +0000204 { "fixup_Mips_Branch_PCRel", 0, 16, MCFixupKindInfo::FKF_IsPCRel },
205 { "fixup_Mips_GPOFF_HI", 0, 16, 0 },
206 { "fixup_Mips_GPOFF_LO", 0, 16, 0 },
207 { "fixup_Mips_GOT_PAGE", 0, 16, 0 },
Jack Carter5ddcfda2012-07-13 19:15:47 +0000208 { "fixup_Mips_GOT_OFST", 0, 16, 0 },
Jack Carter84491ab2012-08-06 21:26:03 +0000209 { "fixup_Mips_GOT_DISP", 0, 16, 0 },
210 { "fixup_Mips_HIGHER", 0, 16, 0 },
Jack Carterb05cb672012-11-21 23:38:59 +0000211 { "fixup_Mips_HIGHEST", 0, 16, 0 },
212 { "fixup_Mips_GOT_HI16", 0, 16, 0 },
213 { "fixup_Mips_GOT_LO16", 0, 16, 0 },
214 { "fixup_Mips_CALL_HI16", 0, 16, 0 },
Zoran Jovanovice7ae8af2013-10-23 16:14:44 +0000215 { "fixup_Mips_CALL_LO16", 0, 16, 0 },
Zoran Jovanovic507e0842013-10-29 16:38:59 +0000216 { "fixup_MICROMIPS_26_S1", 0, 26, 0 },
Zoran Jovanovice7ae8af2013-10-23 16:14:44 +0000217 { "fixup_MICROMIPS_HI16", 0, 16, 0 },
218 { "fixup_MICROMIPS_LO16", 0, 16, 0 },
219 { "fixup_MICROMIPS_GOT16", 0, 16, 0 },
Zoran Jovanovic8a80aa72013-11-04 14:53:22 +0000220 { "fixup_MICROMIPS_PC16_S1", 0, 16, MCFixupKindInfo::FKF_IsPCRel },
Zoran Jovanovice7ae8af2013-10-23 16:14:44 +0000221 { "fixup_MICROMIPS_CALL16", 0, 16, 0 },
222 { "fixup_MICROMIPS_GOT_DISP", 0, 16, 0 },
223 { "fixup_MICROMIPS_GOT_PAGE", 0, 16, 0 },
224 { "fixup_MICROMIPS_GOT_OFST", 0, 16, 0 },
225 { "fixup_MICROMIPS_TLS_DTPREL_HI16", 0, 16, 0 },
226 { "fixup_MICROMIPS_TLS_DTPREL_LO16", 0, 16, 0 },
227 { "fixup_MICROMIPS_TLS_TPREL_HI16", 0, 16, 0 },
228 { "fixup_MICROMIPS_TLS_TPREL_LO16", 0, 16, 0 }
Bruno Cardoso Lopesc85e3ff2011-11-11 22:58:42 +0000229 };
230
231 if (Kind < FirstTargetFixupKind)
232 return MCAsmBackend::getFixupKindInfo(Kind);
233
234 assert(unsigned(Kind - FirstTargetFixupKind) < getNumFixupKinds() &&
235 "Invalid kind!");
236 return Infos[Kind - FirstTargetFixupKind];
Akira Hatanaka44220ca2011-09-30 21:23:45 +0000237 }
238
239 /// @name Target Relaxation Interfaces
240 /// @{
241
242 /// MayNeedRelaxation - Check whether the given instruction may need
243 /// relaxation.
244 ///
245 /// \param Inst - The instruction to test.
Jim Grosbachaba3de92012-01-18 18:52:16 +0000246 bool mayNeedRelaxation(const MCInst &Inst) const {
Akira Hatanaka44220ca2011-09-30 21:23:45 +0000247 return false;
248 }
249
Jim Grosbach25b63fa2011-12-06 00:47:03 +0000250 /// fixupNeedsRelaxation - Target specific predicate for whether a given
251 /// fixup requires the associated instruction to be relaxed.
252 bool fixupNeedsRelaxation(const MCFixup &Fixup,
253 uint64_t Value,
Eli Bendersky4d9ada02013-01-08 00:22:56 +0000254 const MCRelaxableFragment *DF,
Jim Grosbach25b63fa2011-12-06 00:47:03 +0000255 const MCAsmLayout &Layout) const {
256 // FIXME.
257 assert(0 && "RelaxInstruction() unimplemented");
NAKAMURA Takumid3002492011-12-06 01:48:32 +0000258 return false;
Jim Grosbach25b63fa2011-12-06 00:47:03 +0000259 }
260
Bruno Cardoso Lopesc85e3ff2011-11-11 22:58:42 +0000261 /// RelaxInstruction - Relax the instruction in the given fragment
262 /// to the next wider instruction.
Akira Hatanaka44220ca2011-09-30 21:23:45 +0000263 ///
Bruno Cardoso Lopesc85e3ff2011-11-11 22:58:42 +0000264 /// \param Inst - The instruction to relax, which may be the same
265 /// as the output.
Dmitri Gribenko881929c2012-09-12 16:59:47 +0000266 /// \param [out] Res On return, the relaxed instruction.
Jim Grosbachaba3de92012-01-18 18:52:16 +0000267 void relaxInstruction(const MCInst &Inst, MCInst &Res) const {
Akira Hatanaka44220ca2011-09-30 21:23:45 +0000268 }
Jia Liuf54f60f2012-02-28 07:46:26 +0000269
Akira Hatanaka44220ca2011-09-30 21:23:45 +0000270 /// @}
271
Bruno Cardoso Lopesc85e3ff2011-11-11 22:58:42 +0000272 /// WriteNopData - Write an (optimal) nop sequence of Count bytes
273 /// to the given output. If the target cannot generate such a sequence,
274 /// it should return an error.
Akira Hatanaka44220ca2011-09-30 21:23:45 +0000275 ///
276 /// \return - True on success.
Jim Grosbachaba3de92012-01-18 18:52:16 +0000277 bool writeNopData(uint64_t Count, MCObjectWriter *OW) const {
Jack Carter570ae0b2012-07-11 22:17:39 +0000278 // Check for a less than instruction size number of bytes
279 // FIXME: 16 bit instructions are not handled yet here.
280 // We shouldn't be using a hard coded number for instruction size.
281 if (Count % 4) return false;
282
283 uint64_t NumNops = Count / 4;
284 for (uint64_t i = 0; i != NumNops; ++i)
285 OW->Write32(0);
Bruno Cardoso Lopesc85e3ff2011-11-11 22:58:42 +0000286 return true;
Akira Hatanaka44220ca2011-09-30 21:23:45 +0000287 }
Matheus Almeidae0d75aa2013-12-13 11:11:02 +0000288
289 /// processFixupValue - Target hook to process the literal value of a fixup
290 /// if necessary.
291 void processFixupValue(const MCAssembler &Asm, const MCAsmLayout &Layout,
292 const MCFixup &Fixup, const MCFragment *DF,
293 MCValue &Target, uint64_t &Value,
294 bool &IsResolved) {
295 // At this point we'll ignore the value returned by adjustFixupValue as
296 // we are only checking if the fixup can be applied correctly. We have
297 // access to MCContext from here which allows us to report a fatal error
298 // with *possibly* a source code location.
299 (void)adjustFixupValue(Fixup, Value, &Asm.getContext());
300 }
301
Akira Hatanakab1f68f92012-04-02 19:25:22 +0000302}; // class MipsAsmBackend
Akira Hatanaka587fe6c2011-09-30 21:04:02 +0000303
Bruno Cardoso Lopesc85e3ff2011-11-11 22:58:42 +0000304} // namespace
Akira Hatanaka44220ca2011-09-30 21:23:45 +0000305
Akira Hatanaka1ee768d2012-03-01 01:53:15 +0000306// MCAsmBackend
Bill Wendling58e2d3d2013-09-09 02:37:14 +0000307MCAsmBackend *llvm::createMipsAsmBackendEL32(const Target &T,
308 const MCRegisterInfo &MRI,
309 StringRef TT,
Roman Divacky5dd4ccb2012-09-18 16:08:49 +0000310 StringRef CPU) {
Akira Hatanaka1ee768d2012-03-01 01:53:15 +0000311 return new MipsAsmBackend(T, Triple(TT).getOS(),
Akira Hatanakab1f68f92012-04-02 19:25:22 +0000312 /*IsLittle*/true, /*Is64Bit*/false);
Rafael Espindola647841b2012-01-11 04:04:14 +0000313}
Akira Hatanaka44220ca2011-09-30 21:23:45 +0000314
Bill Wendling58e2d3d2013-09-09 02:37:14 +0000315MCAsmBackend *llvm::createMipsAsmBackendEB32(const Target &T,
316 const MCRegisterInfo &MRI,
317 StringRef TT,
Roman Divacky5dd4ccb2012-09-18 16:08:49 +0000318 StringRef CPU) {
Akira Hatanaka1ee768d2012-03-01 01:53:15 +0000319 return new MipsAsmBackend(T, Triple(TT).getOS(),
Akira Hatanakab1f68f92012-04-02 19:25:22 +0000320 /*IsLittle*/false, /*Is64Bit*/false);
Akira Hatanaka44220ca2011-09-30 21:23:45 +0000321}
Akira Hatanakab1f68f92012-04-02 19:25:22 +0000322
Bill Wendling58e2d3d2013-09-09 02:37:14 +0000323MCAsmBackend *llvm::createMipsAsmBackendEL64(const Target &T,
324 const MCRegisterInfo &MRI,
325 StringRef TT,
Roman Divacky5dd4ccb2012-09-18 16:08:49 +0000326 StringRef CPU) {
Akira Hatanakab1f68f92012-04-02 19:25:22 +0000327 return new MipsAsmBackend(T, Triple(TT).getOS(),
328 /*IsLittle*/true, /*Is64Bit*/true);
329}
330
Bill Wendling58e2d3d2013-09-09 02:37:14 +0000331MCAsmBackend *llvm::createMipsAsmBackendEB64(const Target &T,
332 const MCRegisterInfo &MRI,
333 StringRef TT,
Roman Divacky5dd4ccb2012-09-18 16:08:49 +0000334 StringRef CPU) {
Akira Hatanakab1f68f92012-04-02 19:25:22 +0000335 return new MipsAsmBackend(T, Triple(TT).getOS(),
336 /*IsLittle*/false, /*Is64Bit*/true);
337}
338