Zoran Jovanovic | ada38ef | 2014-03-27 12:38:40 +0000 | [diff] [blame] | 1 | //===-- MipsAsmBackend.cpp - Mips Asm Backend ----------------------------===// |
Bruno Cardoso Lopes | c85e3ff | 2011-11-11 22:58:42 +0000 | [diff] [blame] | 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 | // |
Zoran Jovanovic | ada38ef | 2014-03-27 12:38:40 +0000 | [diff] [blame] | 10 | // This file implements the MipsAsmBackend class. |
Bruno Cardoso Lopes | c85e3ff | 2011-11-11 22:58:42 +0000 | [diff] [blame] | 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | // |
| 14 | |
Zoran Jovanovic | ada38ef | 2014-03-27 12:38:40 +0000 | [diff] [blame] | 15 | #include "MCTargetDesc/MipsFixupKinds.h" |
| 16 | #include "MCTargetDesc/MipsAsmBackend.h" |
Akira Hatanaka | 587fe6c | 2011-09-30 21:04:02 +0000 | [diff] [blame] | 17 | #include "MCTargetDesc/MipsMCTargetDesc.h" |
Bruno Cardoso Lopes | c85e3ff | 2011-11-11 22:58:42 +0000 | [diff] [blame] | 18 | #include "llvm/MC/MCAsmBackend.h" |
Akira Hatanaka | 587fe6c | 2011-09-30 21:04:02 +0000 | [diff] [blame] | 19 | #include "llvm/MC/MCAssembler.h" |
Matheus Almeida | e0d75aa | 2013-12-13 11:11:02 +0000 | [diff] [blame] | 20 | #include "llvm/MC/MCContext.h" |
Akira Hatanaka | 587fe6c | 2011-09-30 21:04:02 +0000 | [diff] [blame] | 21 | #include "llvm/MC/MCDirectives.h" |
| 22 | #include "llvm/MC/MCELFObjectWriter.h" |
Craig Topper | 6e80c28 | 2012-03-26 06:58:25 +0000 | [diff] [blame] | 23 | #include "llvm/MC/MCFixupKindInfo.h" |
Akira Hatanaka | 587fe6c | 2011-09-30 21:04:02 +0000 | [diff] [blame] | 24 | #include "llvm/MC/MCObjectWriter.h" |
Akira Hatanaka | 587fe6c | 2011-09-30 21:04:02 +0000 | [diff] [blame] | 25 | #include "llvm/MC/MCSubtargetInfo.h" |
Akira Hatanaka | 587fe6c | 2011-09-30 21:04:02 +0000 | [diff] [blame] | 26 | #include "llvm/Support/ErrorHandling.h" |
Matheus Almeida | e0d75aa | 2013-12-13 11:11:02 +0000 | [diff] [blame] | 27 | #include "llvm/Support/MathExtras.h" |
Chandler Carruth | 8a8cd2b | 2014-01-07 11:48:04 +0000 | [diff] [blame] | 28 | #include "llvm/Support/raw_ostream.h" |
Bruno Cardoso Lopes | 61e6d98 | 2011-12-07 00:28:57 +0000 | [diff] [blame] | 29 | |
Akira Hatanaka | 587fe6c | 2011-09-30 21:04:02 +0000 | [diff] [blame] | 30 | using namespace llvm; |
| 31 | |
Bruno Cardoso Lopes | 61e6d98 | 2011-12-07 00:28:57 +0000 | [diff] [blame] | 32 | // Prepare value for the target space for it |
Matheus Almeida | e0d75aa | 2013-12-13 11:11:02 +0000 | [diff] [blame] | 33 | static unsigned adjustFixupValue(const MCFixup &Fixup, uint64_t Value, |
| 34 | MCContext *Ctx = NULL) { |
| 35 | |
| 36 | unsigned Kind = Fixup.getKind(); |
Bruno Cardoso Lopes | c85e3ff | 2011-11-11 22:58:42 +0000 | [diff] [blame] | 37 | |
| 38 | // Add/subtract and shift |
| 39 | switch (Kind) { |
| 40 | default: |
Bruno Cardoso Lopes | 61e6d98 | 2011-12-07 00:28:57 +0000 | [diff] [blame] | 41 | return 0; |
Ed Maste | 2a710d0 | 2014-03-03 14:27:49 +0000 | [diff] [blame] | 42 | case FK_Data_2: |
Bruno Cardoso Lopes | 61e6d98 | 2011-12-07 00:28:57 +0000 | [diff] [blame] | 43 | case FK_GPRel_4: |
| 44 | case FK_Data_4: |
Jack Carter | 4c58381 | 2012-08-07 00:01:14 +0000 | [diff] [blame] | 45 | case FK_Data_8: |
Bruno Cardoso Lopes | 61e6d98 | 2011-12-07 00:28:57 +0000 | [diff] [blame] | 46 | case Mips::fixup_Mips_LO16: |
Jack Carter | c3dd91c | 2013-01-08 19:01:28 +0000 | [diff] [blame] | 47 | case Mips::fixup_Mips_GPREL16: |
Jack Carter | b9f9de9 | 2012-06-27 22:48:25 +0000 | [diff] [blame] | 48 | case Mips::fixup_Mips_GPOFF_HI: |
| 49 | case Mips::fixup_Mips_GPOFF_LO: |
| 50 | case Mips::fixup_Mips_GOT_PAGE: |
| 51 | case Mips::fixup_Mips_GOT_OFST: |
Jack Carter | 5ddcfda | 2012-07-13 19:15:47 +0000 | [diff] [blame] | 52 | case Mips::fixup_Mips_GOT_DISP: |
Jack Carter | b05cb67 | 2012-11-21 23:38:59 +0000 | [diff] [blame] | 53 | case Mips::fixup_Mips_GOT_LO16: |
| 54 | case Mips::fixup_Mips_CALL_LO16: |
Zoran Jovanovic | e7ae8af | 2013-10-23 16:14:44 +0000 | [diff] [blame] | 55 | case Mips::fixup_MICROMIPS_LO16: |
| 56 | case Mips::fixup_MICROMIPS_GOT_PAGE: |
| 57 | case Mips::fixup_MICROMIPS_GOT_OFST: |
| 58 | case Mips::fixup_MICROMIPS_GOT_DISP: |
Bruno Cardoso Lopes | c85e3ff | 2011-11-11 22:58:42 +0000 | [diff] [blame] | 59 | break; |
| 60 | case Mips::fixup_Mips_PC16: |
| 61 | // So far we are only using this type for branches. |
| 62 | // For branches we start 1 instruction after the branch |
| 63 | // so the displacement will be one instruction size less. |
| 64 | Value -= 4; |
| 65 | // The displacement is then divided by 4 to give us an 18 bit |
Matheus Almeida | e0d75aa | 2013-12-13 11:11:02 +0000 | [diff] [blame] | 66 | // address range. Forcing a signed division because Value can be negative. |
| 67 | Value = (int64_t)Value / 4; |
| 68 | // We now check if Value can be encoded as a 16-bit signed immediate. |
Matheus Almeida | 8cc8b35 | 2013-12-17 17:10:00 +0000 | [diff] [blame] | 69 | if (!isIntN(16, Value) && Ctx) |
Matheus Almeida | e0d75aa | 2013-12-13 11:11:02 +0000 | [diff] [blame] | 70 | Ctx->FatalError(Fixup.getLoc(), "out of range PC16 fixup"); |
Bruno Cardoso Lopes | c85e3ff | 2011-11-11 22:58:42 +0000 | [diff] [blame] | 71 | break; |
| 72 | case Mips::fixup_Mips_26: |
| 73 | // So far we are only using this type for jumps. |
| 74 | // The displacement is then divided by 4 to give us an 28 bit |
| 75 | // address range. |
| 76 | Value >>= 2; |
| 77 | break; |
Akira Hatanaka | f5ddf13 | 2011-11-23 22:18:04 +0000 | [diff] [blame] | 78 | case Mips::fixup_Mips_HI16: |
Bruno Cardoso Lopes | 61e6d98 | 2011-12-07 00:28:57 +0000 | [diff] [blame] | 79 | case Mips::fixup_Mips_GOT_Local: |
Jack Carter | b05cb67 | 2012-11-21 23:38:59 +0000 | [diff] [blame] | 80 | case Mips::fixup_Mips_GOT_HI16: |
| 81 | case Mips::fixup_Mips_CALL_HI16: |
Zoran Jovanovic | e7ae8af | 2013-10-23 16:14:44 +0000 | [diff] [blame] | 82 | case Mips::fixup_MICROMIPS_HI16: |
Jack Carter | 84491ab | 2012-08-06 21:26:03 +0000 | [diff] [blame] | 83 | // Get the 2nd 16-bits. Also add 1 if bit 15 is 1. |
Akira Hatanaka | da72819 | 2012-03-27 01:50:08 +0000 | [diff] [blame] | 84 | Value = ((Value + 0x8000) >> 16) & 0xffff; |
Akira Hatanaka | f5ddf13 | 2011-11-23 22:18:04 +0000 | [diff] [blame] | 85 | break; |
Jack Carter | 84491ab | 2012-08-06 21:26:03 +0000 | [diff] [blame] | 86 | case Mips::fixup_Mips_HIGHER: |
| 87 | // Get the 3rd 16-bits. |
| 88 | Value = ((Value + 0x80008000LL) >> 32) & 0xffff; |
| 89 | break; |
| 90 | case Mips::fixup_Mips_HIGHEST: |
| 91 | // Get the 4th 16-bits. |
| 92 | Value = ((Value + 0x800080008000LL) >> 48) & 0xffff; |
| 93 | break; |
Zoran Jovanovic | 507e084 | 2013-10-29 16:38:59 +0000 | [diff] [blame] | 94 | case Mips::fixup_MICROMIPS_26_S1: |
| 95 | Value >>= 1; |
| 96 | break; |
Zoran Jovanovic | 8a80aa7 | 2013-11-04 14:53:22 +0000 | [diff] [blame] | 97 | case Mips::fixup_MICROMIPS_PC16_S1: |
| 98 | Value -= 4; |
Matheus Almeida | e0d75aa | 2013-12-13 11:11:02 +0000 | [diff] [blame] | 99 | // Forcing a signed division because Value can be negative. |
| 100 | Value = (int64_t)Value / 2; |
| 101 | // We now check if Value can be encoded as a 16-bit signed immediate. |
Matheus Almeida | 8cc8b35 | 2013-12-17 17:10:00 +0000 | [diff] [blame] | 102 | if (!isIntN(16, Value) && Ctx) |
Matheus Almeida | e0d75aa | 2013-12-13 11:11:02 +0000 | [diff] [blame] | 103 | Ctx->FatalError(Fixup.getLoc(), "out of range PC16 fixup"); |
Zoran Jovanovic | 8a80aa7 | 2013-11-04 14:53:22 +0000 | [diff] [blame] | 104 | break; |
Bruno Cardoso Lopes | c85e3ff | 2011-11-11 22:58:42 +0000 | [diff] [blame] | 105 | } |
| 106 | |
| 107 | return Value; |
| 108 | } |
| 109 | |
Zoran Jovanovic | ada38ef | 2014-03-27 12:38:40 +0000 | [diff] [blame] | 110 | MCObjectWriter *MipsAsmBackend::createObjectWriter(raw_ostream &OS) const { |
| 111 | return createMipsELFObjectWriter(OS, |
| 112 | MCELFObjectTargetWriter::getOSABI(OSType), IsLittle, Is64Bit); |
| 113 | } |
Akira Hatanaka | 1ee768d | 2012-03-01 01:53:15 +0000 | [diff] [blame] | 114 | |
Zoran Jovanovic | ada38ef | 2014-03-27 12:38:40 +0000 | [diff] [blame] | 115 | /// ApplyFixup - Apply the \p Value for given \p Fixup into the provided |
| 116 | /// data fragment, at the offset specified by the fixup and following the |
| 117 | /// fixup kind as appropriate. |
| 118 | void MipsAsmBackend::applyFixup(const MCFixup &Fixup, char *Data, |
| 119 | unsigned DataSize, uint64_t Value) const { |
| 120 | MCFixupKind Kind = Fixup.getKind(); |
| 121 | Value = adjustFixupValue(Fixup, Value); |
Akira Hatanaka | 1ee768d | 2012-03-01 01:53:15 +0000 | [diff] [blame] | 122 | |
Zoran Jovanovic | ada38ef | 2014-03-27 12:38:40 +0000 | [diff] [blame] | 123 | if (!Value) |
| 124 | return; // Doesn't change encoding. |
| 125 | |
| 126 | // Where do we start in the object |
| 127 | unsigned Offset = Fixup.getOffset(); |
| 128 | // Number of bytes we need to fixup |
| 129 | unsigned NumBytes = (getFixupKindInfo(Kind).TargetSize + 7) / 8; |
| 130 | // Used to point to big endian bytes |
| 131 | unsigned FullSize; |
| 132 | |
| 133 | switch ((unsigned)Kind) { |
| 134 | case FK_Data_2: |
| 135 | case Mips::fixup_Mips_16: |
| 136 | FullSize = 2; |
| 137 | break; |
| 138 | case FK_Data_8: |
| 139 | case Mips::fixup_Mips_64: |
| 140 | FullSize = 8; |
| 141 | break; |
| 142 | case FK_Data_4: |
| 143 | default: |
| 144 | FullSize = 4; |
| 145 | break; |
Akira Hatanaka | 1ee768d | 2012-03-01 01:53:15 +0000 | [diff] [blame] | 146 | } |
Akira Hatanaka | 44220ca | 2011-09-30 21:23:45 +0000 | [diff] [blame] | 147 | |
Zoran Jovanovic | ada38ef | 2014-03-27 12:38:40 +0000 | [diff] [blame] | 148 | // Grab current value, if any, from bits. |
| 149 | uint64_t CurVal = 0; |
Bruno Cardoso Lopes | c85e3ff | 2011-11-11 22:58:42 +0000 | [diff] [blame] | 150 | |
Zoran Jovanovic | ada38ef | 2014-03-27 12:38:40 +0000 | [diff] [blame] | 151 | for (unsigned i = 0; i != NumBytes; ++i) { |
| 152 | unsigned Idx = IsLittle ? i : (FullSize - 1 - i); |
| 153 | CurVal |= (uint64_t)((uint8_t)Data[Offset + Idx]) << (i*8); |
Akira Hatanaka | 0137dfe | 2012-03-21 00:52:01 +0000 | [diff] [blame] | 154 | } |
Bruno Cardoso Lopes | c85e3ff | 2011-11-11 22:58:42 +0000 | [diff] [blame] | 155 | |
Zoran Jovanovic | ada38ef | 2014-03-27 12:38:40 +0000 | [diff] [blame] | 156 | uint64_t Mask = ((uint64_t)(-1) >> |
| 157 | (64 - getFixupKindInfo(Kind).TargetSize)); |
| 158 | CurVal |= Value & Mask; |
Bruno Cardoso Lopes | c85e3ff | 2011-11-11 22:58:42 +0000 | [diff] [blame] | 159 | |
Zoran Jovanovic | ada38ef | 2014-03-27 12:38:40 +0000 | [diff] [blame] | 160 | // Write out the fixed up bytes back to the code/data bits. |
| 161 | for (unsigned i = 0; i != NumBytes; ++i) { |
| 162 | unsigned Idx = IsLittle ? i : (FullSize - 1 - i); |
| 163 | Data[Offset + Idx] = (uint8_t)((CurVal >> (i*8)) & 0xff); |
Akira Hatanaka | 44220ca | 2011-09-30 21:23:45 +0000 | [diff] [blame] | 164 | } |
Zoran Jovanovic | ada38ef | 2014-03-27 12:38:40 +0000 | [diff] [blame] | 165 | } |
Akira Hatanaka | 44220ca | 2011-09-30 21:23:45 +0000 | [diff] [blame] | 166 | |
Zoran Jovanovic | ada38ef | 2014-03-27 12:38:40 +0000 | [diff] [blame] | 167 | const MCFixupKindInfo &MipsAsmBackend:: |
| 168 | getFixupKindInfo(MCFixupKind Kind) const { |
| 169 | const static MCFixupKindInfo Infos[Mips::NumTargetFixupKinds] = { |
| 170 | // This table *must* be in same the order of fixup_* kinds in |
| 171 | // MipsFixupKinds.h. |
| 172 | // |
| 173 | // name offset bits flags |
| 174 | { "fixup_Mips_16", 0, 16, 0 }, |
| 175 | { "fixup_Mips_32", 0, 32, 0 }, |
| 176 | { "fixup_Mips_REL32", 0, 32, 0 }, |
| 177 | { "fixup_Mips_26", 0, 26, 0 }, |
| 178 | { "fixup_Mips_HI16", 0, 16, 0 }, |
| 179 | { "fixup_Mips_LO16", 0, 16, 0 }, |
| 180 | { "fixup_Mips_GPREL16", 0, 16, 0 }, |
| 181 | { "fixup_Mips_LITERAL", 0, 16, 0 }, |
| 182 | { "fixup_Mips_GOT_Global", 0, 16, 0 }, |
| 183 | { "fixup_Mips_GOT_Local", 0, 16, 0 }, |
| 184 | { "fixup_Mips_PC16", 0, 16, MCFixupKindInfo::FKF_IsPCRel }, |
| 185 | { "fixup_Mips_CALL16", 0, 16, 0 }, |
| 186 | { "fixup_Mips_GPREL32", 0, 32, 0 }, |
| 187 | { "fixup_Mips_SHIFT5", 6, 5, 0 }, |
| 188 | { "fixup_Mips_SHIFT6", 6, 5, 0 }, |
| 189 | { "fixup_Mips_64", 0, 64, 0 }, |
| 190 | { "fixup_Mips_TLSGD", 0, 16, 0 }, |
| 191 | { "fixup_Mips_GOTTPREL", 0, 16, 0 }, |
| 192 | { "fixup_Mips_TPREL_HI", 0, 16, 0 }, |
| 193 | { "fixup_Mips_TPREL_LO", 0, 16, 0 }, |
| 194 | { "fixup_Mips_TLSLDM", 0, 16, 0 }, |
| 195 | { "fixup_Mips_DTPREL_HI", 0, 16, 0 }, |
| 196 | { "fixup_Mips_DTPREL_LO", 0, 16, 0 }, |
| 197 | { "fixup_Mips_Branch_PCRel", 0, 16, MCFixupKindInfo::FKF_IsPCRel }, |
| 198 | { "fixup_Mips_GPOFF_HI", 0, 16, 0 }, |
| 199 | { "fixup_Mips_GPOFF_LO", 0, 16, 0 }, |
| 200 | { "fixup_Mips_GOT_PAGE", 0, 16, 0 }, |
| 201 | { "fixup_Mips_GOT_OFST", 0, 16, 0 }, |
| 202 | { "fixup_Mips_GOT_DISP", 0, 16, 0 }, |
| 203 | { "fixup_Mips_HIGHER", 0, 16, 0 }, |
| 204 | { "fixup_Mips_HIGHEST", 0, 16, 0 }, |
| 205 | { "fixup_Mips_GOT_HI16", 0, 16, 0 }, |
| 206 | { "fixup_Mips_GOT_LO16", 0, 16, 0 }, |
| 207 | { "fixup_Mips_CALL_HI16", 0, 16, 0 }, |
| 208 | { "fixup_Mips_CALL_LO16", 0, 16, 0 }, |
| 209 | { "fixup_MICROMIPS_26_S1", 0, 26, 0 }, |
| 210 | { "fixup_MICROMIPS_HI16", 0, 16, 0 }, |
| 211 | { "fixup_MICROMIPS_LO16", 0, 16, 0 }, |
| 212 | { "fixup_MICROMIPS_GOT16", 0, 16, 0 }, |
| 213 | { "fixup_MICROMIPS_PC16_S1", 0, 16, MCFixupKindInfo::FKF_IsPCRel }, |
| 214 | { "fixup_MICROMIPS_CALL16", 0, 16, 0 }, |
| 215 | { "fixup_MICROMIPS_GOT_DISP", 0, 16, 0 }, |
| 216 | { "fixup_MICROMIPS_GOT_PAGE", 0, 16, 0 }, |
| 217 | { "fixup_MICROMIPS_GOT_OFST", 0, 16, 0 }, |
| 218 | { "fixup_MICROMIPS_TLS_GD", 0, 16, 0 }, |
| 219 | { "fixup_MICROMIPS_TLS_LDM", 0, 16, 0 }, |
| 220 | { "fixup_MICROMIPS_TLS_DTPREL_HI16", 0, 16, 0 }, |
| 221 | { "fixup_MICROMIPS_TLS_DTPREL_LO16", 0, 16, 0 }, |
| 222 | { "fixup_MICROMIPS_TLS_TPREL_HI16", 0, 16, 0 }, |
| 223 | { "fixup_MICROMIPS_TLS_TPREL_LO16", 0, 16, 0 } |
| 224 | }; |
Akira Hatanaka | 44220ca | 2011-09-30 21:23:45 +0000 | [diff] [blame] | 225 | |
Zoran Jovanovic | ada38ef | 2014-03-27 12:38:40 +0000 | [diff] [blame] | 226 | if (Kind < FirstTargetFixupKind) |
| 227 | return MCAsmBackend::getFixupKindInfo(Kind); |
Akira Hatanaka | 44220ca | 2011-09-30 21:23:45 +0000 | [diff] [blame] | 228 | |
Zoran Jovanovic | ada38ef | 2014-03-27 12:38:40 +0000 | [diff] [blame] | 229 | assert(unsigned(Kind - FirstTargetFixupKind) < getNumFixupKinds() && |
| 230 | "Invalid kind!"); |
| 231 | return Infos[Kind - FirstTargetFixupKind]; |
| 232 | } |
Jim Grosbach | 25b63fa | 2011-12-06 00:47:03 +0000 | [diff] [blame] | 233 | |
Zoran Jovanovic | ada38ef | 2014-03-27 12:38:40 +0000 | [diff] [blame] | 234 | /// WriteNopData - Write an (optimal) nop sequence of Count bytes |
| 235 | /// to the given output. If the target cannot generate such a sequence, |
| 236 | /// it should return an error. |
| 237 | /// |
| 238 | /// \return - True on success. |
| 239 | bool MipsAsmBackend::writeNopData(uint64_t Count, MCObjectWriter *OW) const { |
| 240 | // Check for a less than instruction size number of bytes |
| 241 | // FIXME: 16 bit instructions are not handled yet here. |
| 242 | // We shouldn't be using a hard coded number for instruction size. |
| 243 | if (Count % 4) return false; |
Jia Liu | f54f60f | 2012-02-28 07:46:26 +0000 | [diff] [blame] | 244 | |
Zoran Jovanovic | ada38ef | 2014-03-27 12:38:40 +0000 | [diff] [blame] | 245 | uint64_t NumNops = Count / 4; |
| 246 | for (uint64_t i = 0; i != NumNops; ++i) |
| 247 | OW->Write32(0); |
| 248 | return true; |
| 249 | } |
Akira Hatanaka | 44220ca | 2011-09-30 21:23:45 +0000 | [diff] [blame] | 250 | |
Zoran Jovanovic | ada38ef | 2014-03-27 12:38:40 +0000 | [diff] [blame] | 251 | /// processFixupValue - Target hook to process the literal value of a fixup |
| 252 | /// if necessary. |
| 253 | void MipsAsmBackend::processFixupValue(const MCAssembler &Asm, |
| 254 | const MCAsmLayout &Layout, |
| 255 | const MCFixup &Fixup, |
| 256 | const MCFragment *DF, |
| 257 | MCValue &Target, |
| 258 | uint64_t &Value, |
| 259 | bool &IsResolved) { |
| 260 | // At this point we'll ignore the value returned by adjustFixupValue as |
| 261 | // we are only checking if the fixup can be applied correctly. We have |
| 262 | // access to MCContext from here which allows us to report a fatal error |
| 263 | // with *possibly* a source code location. |
| 264 | (void)adjustFixupValue(Fixup, Value, &Asm.getContext()); |
| 265 | } |
Akira Hatanaka | 44220ca | 2011-09-30 21:23:45 +0000 | [diff] [blame] | 266 | |
Akira Hatanaka | 1ee768d | 2012-03-01 01:53:15 +0000 | [diff] [blame] | 267 | // MCAsmBackend |
Bill Wendling | 58e2d3d | 2013-09-09 02:37:14 +0000 | [diff] [blame] | 268 | MCAsmBackend *llvm::createMipsAsmBackendEL32(const Target &T, |
| 269 | const MCRegisterInfo &MRI, |
| 270 | StringRef TT, |
Roman Divacky | 5dd4ccb | 2012-09-18 16:08:49 +0000 | [diff] [blame] | 271 | StringRef CPU) { |
Akira Hatanaka | 1ee768d | 2012-03-01 01:53:15 +0000 | [diff] [blame] | 272 | return new MipsAsmBackend(T, Triple(TT).getOS(), |
Akira Hatanaka | b1f68f9 | 2012-04-02 19:25:22 +0000 | [diff] [blame] | 273 | /*IsLittle*/true, /*Is64Bit*/false); |
Rafael Espindola | 647841b | 2012-01-11 04:04:14 +0000 | [diff] [blame] | 274 | } |
Akira Hatanaka | 44220ca | 2011-09-30 21:23:45 +0000 | [diff] [blame] | 275 | |
Bill Wendling | 58e2d3d | 2013-09-09 02:37:14 +0000 | [diff] [blame] | 276 | MCAsmBackend *llvm::createMipsAsmBackendEB32(const Target &T, |
| 277 | const MCRegisterInfo &MRI, |
| 278 | StringRef TT, |
Roman Divacky | 5dd4ccb | 2012-09-18 16:08:49 +0000 | [diff] [blame] | 279 | StringRef CPU) { |
Akira Hatanaka | 1ee768d | 2012-03-01 01:53:15 +0000 | [diff] [blame] | 280 | return new MipsAsmBackend(T, Triple(TT).getOS(), |
Akira Hatanaka | b1f68f9 | 2012-04-02 19:25:22 +0000 | [diff] [blame] | 281 | /*IsLittle*/false, /*Is64Bit*/false); |
Akira Hatanaka | 44220ca | 2011-09-30 21:23:45 +0000 | [diff] [blame] | 282 | } |
Akira Hatanaka | b1f68f9 | 2012-04-02 19:25:22 +0000 | [diff] [blame] | 283 | |
Bill Wendling | 58e2d3d | 2013-09-09 02:37:14 +0000 | [diff] [blame] | 284 | MCAsmBackend *llvm::createMipsAsmBackendEL64(const Target &T, |
| 285 | const MCRegisterInfo &MRI, |
| 286 | StringRef TT, |
Roman Divacky | 5dd4ccb | 2012-09-18 16:08:49 +0000 | [diff] [blame] | 287 | StringRef CPU) { |
Akira Hatanaka | b1f68f9 | 2012-04-02 19:25:22 +0000 | [diff] [blame] | 288 | return new MipsAsmBackend(T, Triple(TT).getOS(), |
| 289 | /*IsLittle*/true, /*Is64Bit*/true); |
| 290 | } |
| 291 | |
Bill Wendling | 58e2d3d | 2013-09-09 02:37:14 +0000 | [diff] [blame] | 292 | MCAsmBackend *llvm::createMipsAsmBackendEB64(const Target &T, |
| 293 | const MCRegisterInfo &MRI, |
| 294 | StringRef TT, |
Roman Divacky | 5dd4ccb | 2012-09-18 16:08:49 +0000 | [diff] [blame] | 295 | StringRef CPU) { |
Akira Hatanaka | b1f68f9 | 2012-04-02 19:25:22 +0000 | [diff] [blame] | 296 | return new MipsAsmBackend(T, Triple(TT).getOS(), |
| 297 | /*IsLittle*/false, /*Is64Bit*/true); |
| 298 | } |