blob: dfaa4db50d9f3b49dd7ba744f3dc8b83a1608304 [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"
Matheus Almeidae0d75aa2013-12-13 11:11:02 +000026#include "llvm/Support/MathExtras.h"
Chandler Carruth8a8cd2b2014-01-07 11:48:04 +000027#include "llvm/Support/raw_ostream.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;
Ed Maste2a710d02014-03-03 14:27:49 +000041 case FK_Data_2:
Bruno Cardoso Lopes61e6d982011-12-07 00:28:57 +000042 case FK_GPRel_4:
43 case FK_Data_4:
Jack Carter4c583812012-08-07 00:01:14 +000044 case FK_Data_8:
Bruno Cardoso Lopes61e6d982011-12-07 00:28:57 +000045 case Mips::fixup_Mips_LO16:
Jack Carterc3dd91c2013-01-08 19:01:28 +000046 case Mips::fixup_Mips_GPREL16:
Jack Carterb9f9de92012-06-27 22:48:25 +000047 case Mips::fixup_Mips_GPOFF_HI:
48 case Mips::fixup_Mips_GPOFF_LO:
49 case Mips::fixup_Mips_GOT_PAGE:
50 case Mips::fixup_Mips_GOT_OFST:
Jack Carter5ddcfda2012-07-13 19:15:47 +000051 case Mips::fixup_Mips_GOT_DISP:
Jack Carterb05cb672012-11-21 23:38:59 +000052 case Mips::fixup_Mips_GOT_LO16:
53 case Mips::fixup_Mips_CALL_LO16:
Zoran Jovanovice7ae8af2013-10-23 16:14:44 +000054 case Mips::fixup_MICROMIPS_LO16:
55 case Mips::fixup_MICROMIPS_GOT_PAGE:
56 case Mips::fixup_MICROMIPS_GOT_OFST:
57 case Mips::fixup_MICROMIPS_GOT_DISP:
Bruno Cardoso Lopesc85e3ff2011-11-11 22:58:42 +000058 break;
59 case Mips::fixup_Mips_PC16:
60 // So far we are only using this type for branches.
61 // For branches we start 1 instruction after the branch
62 // so the displacement will be one instruction size less.
63 Value -= 4;
64 // The displacement is then divided by 4 to give us an 18 bit
Matheus Almeidae0d75aa2013-12-13 11:11:02 +000065 // address range. Forcing a signed division because Value can be negative.
66 Value = (int64_t)Value / 4;
67 // We now check if Value can be encoded as a 16-bit signed immediate.
Matheus Almeida8cc8b352013-12-17 17:10:00 +000068 if (!isIntN(16, Value) && Ctx)
Matheus Almeidae0d75aa2013-12-13 11:11:02 +000069 Ctx->FatalError(Fixup.getLoc(), "out of range PC16 fixup");
Bruno Cardoso Lopesc85e3ff2011-11-11 22:58:42 +000070 break;
71 case Mips::fixup_Mips_26:
72 // So far we are only using this type for jumps.
73 // The displacement is then divided by 4 to give us an 28 bit
74 // address range.
75 Value >>= 2;
76 break;
Akira Hatanakaf5ddf132011-11-23 22:18:04 +000077 case Mips::fixup_Mips_HI16:
Bruno Cardoso Lopes61e6d982011-12-07 00:28:57 +000078 case Mips::fixup_Mips_GOT_Local:
Jack Carterb05cb672012-11-21 23:38:59 +000079 case Mips::fixup_Mips_GOT_HI16:
80 case Mips::fixup_Mips_CALL_HI16:
Zoran Jovanovice7ae8af2013-10-23 16:14:44 +000081 case Mips::fixup_MICROMIPS_HI16:
Jack Carter84491ab2012-08-06 21:26:03 +000082 // Get the 2nd 16-bits. Also add 1 if bit 15 is 1.
Akira Hatanakada728192012-03-27 01:50:08 +000083 Value = ((Value + 0x8000) >> 16) & 0xffff;
Akira Hatanakaf5ddf132011-11-23 22:18:04 +000084 break;
Jack Carter84491ab2012-08-06 21:26:03 +000085 case Mips::fixup_Mips_HIGHER:
86 // Get the 3rd 16-bits.
87 Value = ((Value + 0x80008000LL) >> 32) & 0xffff;
88 break;
89 case Mips::fixup_Mips_HIGHEST:
90 // Get the 4th 16-bits.
91 Value = ((Value + 0x800080008000LL) >> 48) & 0xffff;
92 break;
Zoran Jovanovic507e0842013-10-29 16:38:59 +000093 case Mips::fixup_MICROMIPS_26_S1:
94 Value >>= 1;
95 break;
Zoran Jovanovic8a80aa72013-11-04 14:53:22 +000096 case Mips::fixup_MICROMIPS_PC16_S1:
97 Value -= 4;
Matheus Almeidae0d75aa2013-12-13 11:11:02 +000098 // Forcing a signed division because Value can be negative.
99 Value = (int64_t)Value / 2;
100 // We now check if Value can be encoded as a 16-bit signed immediate.
Matheus Almeida8cc8b352013-12-17 17:10:00 +0000101 if (!isIntN(16, Value) && Ctx)
Matheus Almeidae0d75aa2013-12-13 11:11:02 +0000102 Ctx->FatalError(Fixup.getLoc(), "out of range PC16 fixup");
Zoran Jovanovic8a80aa72013-11-04 14:53:22 +0000103 break;
Bruno Cardoso Lopesc85e3ff2011-11-11 22:58:42 +0000104 }
105
106 return Value;
107}
108
Akira Hatanaka587fe6c2011-09-30 21:04:02 +0000109namespace {
Akira Hatanaka587fe6c2011-09-30 21:04:02 +0000110class MipsAsmBackend : public MCAsmBackend {
Akira Hatanaka1ee768d2012-03-01 01:53:15 +0000111 Triple::OSType OSType;
112 bool IsLittle; // Big or little endian
Akira Hatanakab1f68f92012-04-02 19:25:22 +0000113 bool Is64Bit; // 32 or 64 bit words
Akira Hatanaka1ee768d2012-03-01 01:53:15 +0000114
Akira Hatanaka587fe6c2011-09-30 21:04:02 +0000115public:
Akira Hatanakab1f68f92012-04-02 19:25:22 +0000116 MipsAsmBackend(const Target &T, Triple::OSType _OSType,
117 bool _isLittle, bool _is64Bit)
118 :MCAsmBackend(), OSType(_OSType), IsLittle(_isLittle), Is64Bit(_is64Bit) {}
Akira Hatanaka1ee768d2012-03-01 01:53:15 +0000119
120 MCObjectWriter *createObjectWriter(raw_ostream &OS) const {
Jack Carter06de0fb2012-07-02 20:04:43 +0000121 return createMipsELFObjectWriter(OS,
122 MCELFObjectTargetWriter::getOSABI(OSType), IsLittle, Is64Bit);
Akira Hatanaka1ee768d2012-03-01 01:53:15 +0000123 }
Akira Hatanaka44220ca2011-09-30 21:23:45 +0000124
Dmitri Gribenko5485acd2012-09-14 14:57:36 +0000125 /// ApplyFixup - Apply the \p Value for given \p Fixup into the provided
Akira Hatanaka44220ca2011-09-30 21:23:45 +0000126 /// data fragment, at the offset specified by the fixup and following the
127 /// fixup kind as appropriate.
Jim Grosbachaba3de92012-01-18 18:52:16 +0000128 void applyFixup(const MCFixup &Fixup, char *Data, unsigned DataSize,
Akira Hatanaka44220ca2011-09-30 21:23:45 +0000129 uint64_t Value) const {
Bruno Cardoso Lopes61e6d982011-12-07 00:28:57 +0000130 MCFixupKind Kind = Fixup.getKind();
Matheus Almeidae0d75aa2013-12-13 11:11:02 +0000131 Value = adjustFixupValue(Fixup, Value);
Bruno Cardoso Lopesc85e3ff2011-11-11 22:58:42 +0000132
Akira Hatanaka3e9d81f2012-04-16 18:00:19 +0000133 if (!Value)
Bruno Cardoso Lopes61e6d982011-12-07 00:28:57 +0000134 return; // Doesn't change encoding.
Bruno Cardoso Lopesc85e3ff2011-11-11 22:58:42 +0000135
Akira Hatanaka0137dfe2012-03-21 00:52:01 +0000136 // Where do we start in the object
Bruno Cardoso Lopesc85e3ff2011-11-11 22:58:42 +0000137 unsigned Offset = Fixup.getOffset();
Akira Hatanaka0137dfe2012-03-21 00:52:01 +0000138 // Number of bytes we need to fixup
139 unsigned NumBytes = (getFixupKindInfo(Kind).TargetSize + 7) / 8;
140 // Used to point to big endian bytes
141 unsigned FullSize;
142
Craig Topper344e0122012-03-21 02:28:53 +0000143 switch ((unsigned)Kind) {
Ed Maste2a710d02014-03-03 14:27:49 +0000144 case FK_Data_2:
Akira Hatanaka0137dfe2012-03-21 00:52:01 +0000145 case Mips::fixup_Mips_16:
146 FullSize = 2;
147 break;
Ed Maste2a710d02014-03-03 14:27:49 +0000148 case FK_Data_8:
Akira Hatanaka0137dfe2012-03-21 00:52:01 +0000149 case Mips::fixup_Mips_64:
150 FullSize = 8;
151 break;
Ed Maste2a710d02014-03-03 14:27:49 +0000152 case FK_Data_4:
Akira Hatanaka0137dfe2012-03-21 00:52:01 +0000153 default:
154 FullSize = 4;
155 break;
156 }
Bruno Cardoso Lopes61e6d982011-12-07 00:28:57 +0000157
158 // Grab current value, if any, from bits.
159 uint64_t CurVal = 0;
Bruno Cardoso Lopes61e6d982011-12-07 00:28:57 +0000160
Akira Hatanaka0137dfe2012-03-21 00:52:01 +0000161 for (unsigned i = 0; i != NumBytes; ++i) {
162 unsigned Idx = IsLittle ? i : (FullSize - 1 - i);
163 CurVal |= (uint64_t)((uint8_t)Data[Offset + Idx]) << (i*8);
164 }
165
Akira Hatanaka5fd22482012-06-14 21:10:56 +0000166 uint64_t Mask = ((uint64_t)(-1) >>
167 (64 - getFixupKindInfo(Kind).TargetSize));
Akira Hatanaka3e9d81f2012-04-16 18:00:19 +0000168 CurVal |= Value & Mask;
Bruno Cardoso Lopes61e6d982011-12-07 00:28:57 +0000169
Akira Hatanaka0137dfe2012-03-21 00:52:01 +0000170 // Write out the fixed up bytes back to the code/data bits.
Bruno Cardoso Lopes61e6d982011-12-07 00:28:57 +0000171 for (unsigned i = 0; i != NumBytes; ++i) {
Akira Hatanaka0137dfe2012-03-21 00:52:01 +0000172 unsigned Idx = IsLittle ? i : (FullSize - 1 - i);
173 Data[Offset + Idx] = (uint8_t)((CurVal >> (i*8)) & 0xff);
Bruno Cardoso Lopesc85e3ff2011-11-11 22:58:42 +0000174 }
Akira Hatanaka0137dfe2012-03-21 00:52:01 +0000175 }
Bruno Cardoso Lopesc85e3ff2011-11-11 22:58:42 +0000176
177 unsigned getNumFixupKinds() const { return Mips::NumTargetFixupKinds; }
178
179 const MCFixupKindInfo &getFixupKindInfo(MCFixupKind Kind) const {
180 const static MCFixupKindInfo Infos[Mips::NumTargetFixupKinds] = {
Bruno Cardoso Lopes61e6d982011-12-07 00:28:57 +0000181 // This table *must* be in same the order of fixup_* kinds in
Bruno Cardoso Lopesc85e3ff2011-11-11 22:58:42 +0000182 // MipsFixupKinds.h.
183 //
184 // name offset bits flags
Bruno Cardoso Lopesc85e3ff2011-11-11 22:58:42 +0000185 { "fixup_Mips_16", 0, 16, 0 },
186 { "fixup_Mips_32", 0, 32, 0 },
187 { "fixup_Mips_REL32", 0, 32, 0 },
188 { "fixup_Mips_26", 0, 26, 0 },
189 { "fixup_Mips_HI16", 0, 16, 0 },
190 { "fixup_Mips_LO16", 0, 16, 0 },
191 { "fixup_Mips_GPREL16", 0, 16, 0 },
192 { "fixup_Mips_LITERAL", 0, 16, 0 },
Bruno Cardoso Lopes61e6d982011-12-07 00:28:57 +0000193 { "fixup_Mips_GOT_Global", 0, 16, 0 },
194 { "fixup_Mips_GOT_Local", 0, 16, 0 },
Bruno Cardoso Lopesc85e3ff2011-11-11 22:58:42 +0000195 { "fixup_Mips_PC16", 0, 16, MCFixupKindInfo::FKF_IsPCRel },
196 { "fixup_Mips_CALL16", 0, 16, 0 },
197 { "fixup_Mips_GPREL32", 0, 32, 0 },
198 { "fixup_Mips_SHIFT5", 6, 5, 0 },
199 { "fixup_Mips_SHIFT6", 6, 5, 0 },
200 { "fixup_Mips_64", 0, 64, 0 },
201 { "fixup_Mips_TLSGD", 0, 16, 0 },
202 { "fixup_Mips_GOTTPREL", 0, 16, 0 },
203 { "fixup_Mips_TPREL_HI", 0, 16, 0 },
204 { "fixup_Mips_TPREL_LO", 0, 16, 0 },
Akira Hatanakae2eed962011-12-22 01:05:17 +0000205 { "fixup_Mips_TLSLDM", 0, 16, 0 },
206 { "fixup_Mips_DTPREL_HI", 0, 16, 0 },
207 { "fixup_Mips_DTPREL_LO", 0, 16, 0 },
Jack Carterb9f9de92012-06-27 22:48:25 +0000208 { "fixup_Mips_Branch_PCRel", 0, 16, MCFixupKindInfo::FKF_IsPCRel },
209 { "fixup_Mips_GPOFF_HI", 0, 16, 0 },
210 { "fixup_Mips_GPOFF_LO", 0, 16, 0 },
211 { "fixup_Mips_GOT_PAGE", 0, 16, 0 },
Jack Carter5ddcfda2012-07-13 19:15:47 +0000212 { "fixup_Mips_GOT_OFST", 0, 16, 0 },
Jack Carter84491ab2012-08-06 21:26:03 +0000213 { "fixup_Mips_GOT_DISP", 0, 16, 0 },
214 { "fixup_Mips_HIGHER", 0, 16, 0 },
Jack Carterb05cb672012-11-21 23:38:59 +0000215 { "fixup_Mips_HIGHEST", 0, 16, 0 },
216 { "fixup_Mips_GOT_HI16", 0, 16, 0 },
217 { "fixup_Mips_GOT_LO16", 0, 16, 0 },
218 { "fixup_Mips_CALL_HI16", 0, 16, 0 },
Zoran Jovanovice7ae8af2013-10-23 16:14:44 +0000219 { "fixup_Mips_CALL_LO16", 0, 16, 0 },
Zoran Jovanovic507e0842013-10-29 16:38:59 +0000220 { "fixup_MICROMIPS_26_S1", 0, 26, 0 },
Zoran Jovanovice7ae8af2013-10-23 16:14:44 +0000221 { "fixup_MICROMIPS_HI16", 0, 16, 0 },
222 { "fixup_MICROMIPS_LO16", 0, 16, 0 },
223 { "fixup_MICROMIPS_GOT16", 0, 16, 0 },
Zoran Jovanovic8a80aa72013-11-04 14:53:22 +0000224 { "fixup_MICROMIPS_PC16_S1", 0, 16, MCFixupKindInfo::FKF_IsPCRel },
Zoran Jovanovice7ae8af2013-10-23 16:14:44 +0000225 { "fixup_MICROMIPS_CALL16", 0, 16, 0 },
226 { "fixup_MICROMIPS_GOT_DISP", 0, 16, 0 },
227 { "fixup_MICROMIPS_GOT_PAGE", 0, 16, 0 },
228 { "fixup_MICROMIPS_GOT_OFST", 0, 16, 0 },
Zoran Jovanovic69be8112013-12-19 16:02:32 +0000229 { "fixup_MICROMIPS_TLS_GD", 0, 16, 0 },
230 { "fixup_MICROMIPS_TLS_LDM", 0, 16, 0 },
Zoran Jovanovice7ae8af2013-10-23 16:14:44 +0000231 { "fixup_MICROMIPS_TLS_DTPREL_HI16", 0, 16, 0 },
232 { "fixup_MICROMIPS_TLS_DTPREL_LO16", 0, 16, 0 },
233 { "fixup_MICROMIPS_TLS_TPREL_HI16", 0, 16, 0 },
234 { "fixup_MICROMIPS_TLS_TPREL_LO16", 0, 16, 0 }
Bruno Cardoso Lopesc85e3ff2011-11-11 22:58:42 +0000235 };
236
237 if (Kind < FirstTargetFixupKind)
238 return MCAsmBackend::getFixupKindInfo(Kind);
239
240 assert(unsigned(Kind - FirstTargetFixupKind) < getNumFixupKinds() &&
241 "Invalid kind!");
242 return Infos[Kind - FirstTargetFixupKind];
Akira Hatanaka44220ca2011-09-30 21:23:45 +0000243 }
244
245 /// @name Target Relaxation Interfaces
246 /// @{
247
248 /// MayNeedRelaxation - Check whether the given instruction may need
249 /// relaxation.
250 ///
251 /// \param Inst - The instruction to test.
Jim Grosbachaba3de92012-01-18 18:52:16 +0000252 bool mayNeedRelaxation(const MCInst &Inst) const {
Akira Hatanaka44220ca2011-09-30 21:23:45 +0000253 return false;
254 }
255
Jim Grosbach25b63fa2011-12-06 00:47:03 +0000256 /// fixupNeedsRelaxation - Target specific predicate for whether a given
257 /// fixup requires the associated instruction to be relaxed.
258 bool fixupNeedsRelaxation(const MCFixup &Fixup,
259 uint64_t Value,
Eli Bendersky4d9ada02013-01-08 00:22:56 +0000260 const MCRelaxableFragment *DF,
Jim Grosbach25b63fa2011-12-06 00:47:03 +0000261 const MCAsmLayout &Layout) const {
262 // FIXME.
263 assert(0 && "RelaxInstruction() unimplemented");
NAKAMURA Takumid3002492011-12-06 01:48:32 +0000264 return false;
Jim Grosbach25b63fa2011-12-06 00:47:03 +0000265 }
266
Bruno Cardoso Lopesc85e3ff2011-11-11 22:58:42 +0000267 /// RelaxInstruction - Relax the instruction in the given fragment
268 /// to the next wider instruction.
Akira Hatanaka44220ca2011-09-30 21:23:45 +0000269 ///
Bruno Cardoso Lopesc85e3ff2011-11-11 22:58:42 +0000270 /// \param Inst - The instruction to relax, which may be the same
271 /// as the output.
Dmitri Gribenko881929c2012-09-12 16:59:47 +0000272 /// \param [out] Res On return, the relaxed instruction.
Jim Grosbachaba3de92012-01-18 18:52:16 +0000273 void relaxInstruction(const MCInst &Inst, MCInst &Res) const {
Akira Hatanaka44220ca2011-09-30 21:23:45 +0000274 }
Jia Liuf54f60f2012-02-28 07:46:26 +0000275
Akira Hatanaka44220ca2011-09-30 21:23:45 +0000276 /// @}
277
Bruno Cardoso Lopesc85e3ff2011-11-11 22:58:42 +0000278 /// WriteNopData - Write an (optimal) nop sequence of Count bytes
279 /// to the given output. If the target cannot generate such a sequence,
280 /// it should return an error.
Akira Hatanaka44220ca2011-09-30 21:23:45 +0000281 ///
282 /// \return - True on success.
Jim Grosbachaba3de92012-01-18 18:52:16 +0000283 bool writeNopData(uint64_t Count, MCObjectWriter *OW) const {
Jack Carter570ae0b2012-07-11 22:17:39 +0000284 // Check for a less than instruction size number of bytes
285 // FIXME: 16 bit instructions are not handled yet here.
286 // We shouldn't be using a hard coded number for instruction size.
287 if (Count % 4) return false;
288
289 uint64_t NumNops = Count / 4;
290 for (uint64_t i = 0; i != NumNops; ++i)
291 OW->Write32(0);
Bruno Cardoso Lopesc85e3ff2011-11-11 22:58:42 +0000292 return true;
Akira Hatanaka44220ca2011-09-30 21:23:45 +0000293 }
Matheus Almeidae0d75aa2013-12-13 11:11:02 +0000294
295 /// processFixupValue - Target hook to process the literal value of a fixup
296 /// if necessary.
297 void processFixupValue(const MCAssembler &Asm, const MCAsmLayout &Layout,
298 const MCFixup &Fixup, const MCFragment *DF,
299 MCValue &Target, uint64_t &Value,
300 bool &IsResolved) {
301 // At this point we'll ignore the value returned by adjustFixupValue as
302 // we are only checking if the fixup can be applied correctly. We have
303 // access to MCContext from here which allows us to report a fatal error
304 // with *possibly* a source code location.
305 (void)adjustFixupValue(Fixup, Value, &Asm.getContext());
306 }
307
Akira Hatanakab1f68f92012-04-02 19:25:22 +0000308}; // class MipsAsmBackend
Akira Hatanaka587fe6c2011-09-30 21:04:02 +0000309
Bruno Cardoso Lopesc85e3ff2011-11-11 22:58:42 +0000310} // namespace
Akira Hatanaka44220ca2011-09-30 21:23:45 +0000311
Akira Hatanaka1ee768d2012-03-01 01:53:15 +0000312// MCAsmBackend
Bill Wendling58e2d3d2013-09-09 02:37:14 +0000313MCAsmBackend *llvm::createMipsAsmBackendEL32(const Target &T,
314 const MCRegisterInfo &MRI,
315 StringRef TT,
Roman Divacky5dd4ccb2012-09-18 16:08:49 +0000316 StringRef CPU) {
Akira Hatanaka1ee768d2012-03-01 01:53:15 +0000317 return new MipsAsmBackend(T, Triple(TT).getOS(),
Akira Hatanakab1f68f92012-04-02 19:25:22 +0000318 /*IsLittle*/true, /*Is64Bit*/false);
Rafael Espindola647841b2012-01-11 04:04:14 +0000319}
Akira Hatanaka44220ca2011-09-30 21:23:45 +0000320
Bill Wendling58e2d3d2013-09-09 02:37:14 +0000321MCAsmBackend *llvm::createMipsAsmBackendEB32(const Target &T,
322 const MCRegisterInfo &MRI,
323 StringRef TT,
Roman Divacky5dd4ccb2012-09-18 16:08:49 +0000324 StringRef CPU) {
Akira Hatanaka1ee768d2012-03-01 01:53:15 +0000325 return new MipsAsmBackend(T, Triple(TT).getOS(),
Akira Hatanakab1f68f92012-04-02 19:25:22 +0000326 /*IsLittle*/false, /*Is64Bit*/false);
Akira Hatanaka44220ca2011-09-30 21:23:45 +0000327}
Akira Hatanakab1f68f92012-04-02 19:25:22 +0000328
Bill Wendling58e2d3d2013-09-09 02:37:14 +0000329MCAsmBackend *llvm::createMipsAsmBackendEL64(const Target &T,
330 const MCRegisterInfo &MRI,
331 StringRef TT,
Roman Divacky5dd4ccb2012-09-18 16:08:49 +0000332 StringRef CPU) {
Akira Hatanakab1f68f92012-04-02 19:25:22 +0000333 return new MipsAsmBackend(T, Triple(TT).getOS(),
334 /*IsLittle*/true, /*Is64Bit*/true);
335}
336
Bill Wendling58e2d3d2013-09-09 02:37:14 +0000337MCAsmBackend *llvm::createMipsAsmBackendEB64(const Target &T,
338 const MCRegisterInfo &MRI,
339 StringRef TT,
Roman Divacky5dd4ccb2012-09-18 16:08:49 +0000340 StringRef CPU) {
Akira Hatanakab1f68f92012-04-02 19:25:22 +0000341 return new MipsAsmBackend(T, Triple(TT).getOS(),
342 /*IsLittle*/false, /*Is64Bit*/true);
343}
344