Andrew Trick | 153ebe6 | 2013-10-31 22:11:56 +0000 | [diff] [blame] | 1 | //===---------------------------- StackMaps.cpp ---------------------------===// |
| 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 | #define DEBUG_TYPE "stackmaps" |
| 11 | |
| 12 | #include "llvm/CodeGen/StackMaps.h" |
| 13 | |
| 14 | #include "llvm/CodeGen/AsmPrinter.h" |
| 15 | #include "llvm/CodeGen/MachineInstr.h" |
Lang Hames | 3960999 | 2013-11-29 03:07:54 +0000 | [diff] [blame] | 16 | #include "llvm/IR/DataLayout.h" |
Andrew Trick | 153ebe6 | 2013-10-31 22:11:56 +0000 | [diff] [blame] | 17 | #include "llvm/MC/MCContext.h" |
| 18 | #include "llvm/MC/MCExpr.h" |
Lang Hames | 8a06570 | 2013-11-08 22:30:52 +0000 | [diff] [blame] | 19 | #include "llvm/MC/MCObjectFileInfo.h" |
Andrew Trick | 153ebe6 | 2013-10-31 22:11:56 +0000 | [diff] [blame] | 20 | #include "llvm/MC/MCSectionMachO.h" |
| 21 | #include "llvm/MC/MCStreamer.h" |
| 22 | #include "llvm/Support/Debug.h" |
| 23 | #include "llvm/Support/raw_ostream.h" |
| 24 | #include "llvm/Target/TargetOpcodes.h" |
| 25 | #include "llvm/Target/TargetMachine.h" |
| 26 | #include "llvm/Target/TargetRegisterInfo.h" |
| 27 | |
| 28 | #include <iterator> |
| 29 | |
| 30 | using namespace llvm; |
| 31 | |
Andrew Trick | d4e3dc6 | 2013-11-19 03:29:56 +0000 | [diff] [blame] | 32 | PatchPointOpers::PatchPointOpers(const MachineInstr *MI): |
| 33 | MI(MI), |
| 34 | HasDef(MI->getOperand(0).isReg() && MI->getOperand(0).isDef() && |
| 35 | !MI->getOperand(0).isImplicit()), |
| 36 | IsAnyReg(MI->getOperand(getMetaIdx(CCPos)).getImm() == CallingConv::AnyReg) { |
| 37 | |
| 38 | #ifndef NDEBUG |
| 39 | { |
| 40 | unsigned CheckStartIdx = 0, e = MI->getNumOperands(); |
| 41 | while (CheckStartIdx < e && MI->getOperand(CheckStartIdx).isReg() && |
| 42 | MI->getOperand(CheckStartIdx).isDef() && |
| 43 | !MI->getOperand(CheckStartIdx).isImplicit()) |
| 44 | ++CheckStartIdx; |
| 45 | |
| 46 | assert(getMetaIdx() == CheckStartIdx && |
| 47 | "Unexpected additonal definition in Patchpoint intrinsic."); |
| 48 | } |
| 49 | #endif |
| 50 | } |
| 51 | |
| 52 | unsigned PatchPointOpers::getNextScratchIdx(unsigned StartIdx) const { |
| 53 | if (!StartIdx) |
| 54 | StartIdx = getVarIdx(); |
| 55 | |
| 56 | // Find the next scratch register (implicit def and early clobber) |
| 57 | unsigned ScratchIdx = StartIdx, e = MI->getNumOperands(); |
| 58 | while (ScratchIdx < e && |
| 59 | !(MI->getOperand(ScratchIdx).isReg() && |
| 60 | MI->getOperand(ScratchIdx).isDef() && |
| 61 | MI->getOperand(ScratchIdx).isImplicit() && |
| 62 | MI->getOperand(ScratchIdx).isEarlyClobber())) |
| 63 | ++ScratchIdx; |
| 64 | |
| 65 | assert(ScratchIdx != e && "No scratch register available"); |
| 66 | return ScratchIdx; |
| 67 | } |
| 68 | |
Lang Hames | 3960999 | 2013-11-29 03:07:54 +0000 | [diff] [blame] | 69 | std::pair<StackMaps::Location, MachineInstr::const_mop_iterator> |
| 70 | StackMaps::parseOperand(MachineInstr::const_mop_iterator MOI, |
Andrew Trick | 7bcb010 | 2013-12-13 18:57:20 +0000 | [diff] [blame] | 71 | MachineInstr::const_mop_iterator MOE) { |
Lang Hames | 3960999 | 2013-11-29 03:07:54 +0000 | [diff] [blame] | 72 | const MachineOperand &MOP = *MOI; |
Andrew Trick | 7bcb010 | 2013-12-13 18:57:20 +0000 | [diff] [blame] | 73 | assert(!MOP.isRegMask() && (!MOP.isReg() || !MOP.isImplicit()) && |
| 74 | "Register mask and implicit operands should not be processed."); |
Lang Hames | 3960999 | 2013-11-29 03:07:54 +0000 | [diff] [blame] | 75 | |
| 76 | if (MOP.isImm()) { |
| 77 | // Verify anyregcc |
| 78 | // [<def>], <id>, <numBytes>, <target>, <numArgs>, <cc>, ... |
| 79 | |
| 80 | switch (MOP.getImm()) { |
| 81 | default: llvm_unreachable("Unrecognized operand type."); |
| 82 | case StackMaps::DirectMemRefOp: { |
| 83 | unsigned Size = AP.TM.getDataLayout()->getPointerSizeInBits(); |
| 84 | assert((Size % 8) == 0 && "Need pointer size in bytes."); |
| 85 | Size /= 8; |
| 86 | unsigned Reg = (++MOI)->getReg(); |
| 87 | int64_t Imm = (++MOI)->getImm(); |
| 88 | return std::make_pair( |
| 89 | Location(StackMaps::Location::Direct, Size, Reg, Imm), ++MOI); |
| 90 | } |
| 91 | case StackMaps::IndirectMemRefOp: { |
| 92 | int64_t Size = (++MOI)->getImm(); |
| 93 | assert(Size > 0 && "Need a valid size for indirect memory locations."); |
| 94 | unsigned Reg = (++MOI)->getReg(); |
| 95 | int64_t Imm = (++MOI)->getImm(); |
| 96 | return std::make_pair( |
| 97 | Location(StackMaps::Location::Indirect, Size, Reg, Imm), ++MOI); |
| 98 | } |
| 99 | case StackMaps::ConstantOp: { |
| 100 | ++MOI; |
| 101 | assert(MOI->isImm() && "Expected constant operand."); |
| 102 | int64_t Imm = MOI->getImm(); |
| 103 | return std::make_pair( |
| 104 | Location(Location::Constant, sizeof(int64_t), 0, Imm), ++MOI); |
| 105 | } |
| 106 | } |
| 107 | } |
| 108 | |
| 109 | // Otherwise this is a reg operand. The physical register number will |
| 110 | // ultimately be encoded as a DWARF regno. The stack map also records the size |
| 111 | // of a spill slot that can hold the register content. (The runtime can |
| 112 | // track the actual size of the data type if it needs to.) |
| 113 | assert(MOP.isReg() && "Expected register operand here."); |
| 114 | assert(TargetRegisterInfo::isPhysicalRegister(MOP.getReg()) && |
| 115 | "Virtreg operands should have been rewritten before now."); |
| 116 | const TargetRegisterClass *RC = |
| 117 | AP.TM.getRegisterInfo()->getMinimalPhysRegClass(MOP.getReg()); |
| 118 | assert(!MOP.getSubReg() && "Physical subreg still around."); |
| 119 | return std::make_pair( |
| 120 | Location(Location::Register, RC->getSize(), MOP.getReg(), 0), ++MOI); |
| 121 | } |
| 122 | |
Andrew Trick | e8cba37 | 2013-12-13 18:37:10 +0000 | [diff] [blame] | 123 | void StackMaps::recordStackMapOpers(const MachineInstr &MI, uint64_t ID, |
Andrew Trick | d4e3dc6 | 2013-11-19 03:29:56 +0000 | [diff] [blame] | 124 | MachineInstr::const_mop_iterator MOI, |
| 125 | MachineInstr::const_mop_iterator MOE, |
| 126 | bool recordResult) { |
Andrew Trick | 153ebe6 | 2013-10-31 22:11:56 +0000 | [diff] [blame] | 127 | |
| 128 | MCContext &OutContext = AP.OutStreamer.getContext(); |
| 129 | MCSymbol *MILabel = OutContext.CreateTempSymbol(); |
| 130 | AP.OutStreamer.EmitLabel(MILabel); |
| 131 | |
Andrew Trick | 7bcb010 | 2013-12-13 18:57:20 +0000 | [diff] [blame] | 132 | LocationVec CallsiteLocs; |
Andrew Trick | 153ebe6 | 2013-10-31 22:11:56 +0000 | [diff] [blame] | 133 | |
Juergen Ributzka | 9969d3e | 2013-11-08 23:28:16 +0000 | [diff] [blame] | 134 | if (recordResult) { |
| 135 | std::pair<Location, MachineInstr::const_mop_iterator> ParseResult = |
Lang Hames | 3960999 | 2013-11-29 03:07:54 +0000 | [diff] [blame] | 136 | parseOperand(MI.operands_begin(), llvm::next(MI.operands_begin())); |
Juergen Ributzka | 9969d3e | 2013-11-08 23:28:16 +0000 | [diff] [blame] | 137 | |
| 138 | Location &Loc = ParseResult.first; |
| 139 | assert(Loc.LocType == Location::Register && |
| 140 | "Stackmap return location must be a register."); |
Andrew Trick | 7bcb010 | 2013-12-13 18:57:20 +0000 | [diff] [blame] | 141 | CallsiteLocs.push_back(Loc); |
Juergen Ributzka | 9969d3e | 2013-11-08 23:28:16 +0000 | [diff] [blame] | 142 | } |
| 143 | |
Andrew Trick | 153ebe6 | 2013-10-31 22:11:56 +0000 | [diff] [blame] | 144 | while (MOI != MOE) { |
Lang Hames | 3960999 | 2013-11-29 03:07:54 +0000 | [diff] [blame] | 145 | Location Loc; |
| 146 | tie(Loc, MOI) = parseOperand(MOI, MOE); |
Andrew Trick | 153ebe6 | 2013-10-31 22:11:56 +0000 | [diff] [blame] | 147 | |
| 148 | // Move large constants into the constant pool. |
| 149 | if (Loc.LocType == Location::Constant && (Loc.Offset & ~0xFFFFFFFFULL)) { |
| 150 | Loc.LocType = Location::ConstantIndex; |
| 151 | Loc.Offset = ConstPool.getConstantIndex(Loc.Offset); |
| 152 | } |
| 153 | |
Andrew Trick | 7bcb010 | 2013-12-13 18:57:20 +0000 | [diff] [blame] | 154 | CallsiteLocs.push_back(Loc); |
Andrew Trick | 153ebe6 | 2013-10-31 22:11:56 +0000 | [diff] [blame] | 155 | } |
| 156 | |
| 157 | const MCExpr *CSOffsetExpr = MCBinaryExpr::CreateSub( |
| 158 | MCSymbolRefExpr::Create(MILabel, OutContext), |
| 159 | MCSymbolRefExpr::Create(AP.CurrentFnSym, OutContext), |
| 160 | OutContext); |
| 161 | |
Andrew Trick | 7bcb010 | 2013-12-13 18:57:20 +0000 | [diff] [blame] | 162 | CSInfos.push_back(CallsiteInfo(CSOffsetExpr, ID, CallsiteLocs)); |
Andrew Trick | 153ebe6 | 2013-10-31 22:11:56 +0000 | [diff] [blame] | 163 | } |
| 164 | |
Andrew Trick | d4e3dc6 | 2013-11-19 03:29:56 +0000 | [diff] [blame] | 165 | static MachineInstr::const_mop_iterator |
| 166 | getStackMapEndMOP(MachineInstr::const_mop_iterator MOI, |
| 167 | MachineInstr::const_mop_iterator MOE) { |
| 168 | for (; MOI != MOE; ++MOI) |
Andrew Trick | 7bcb010 | 2013-12-13 18:57:20 +0000 | [diff] [blame] | 169 | if (MOI->isRegMask() || (MOI->isReg() && MOI->isImplicit())) |
Andrew Trick | d4e3dc6 | 2013-11-19 03:29:56 +0000 | [diff] [blame] | 170 | break; |
Andrew Trick | 7bcb010 | 2013-12-13 18:57:20 +0000 | [diff] [blame] | 171 | |
Andrew Trick | d4e3dc6 | 2013-11-19 03:29:56 +0000 | [diff] [blame] | 172 | return MOI; |
| 173 | } |
| 174 | |
| 175 | void StackMaps::recordStackMap(const MachineInstr &MI) { |
Andrew Trick | 7bcb010 | 2013-12-13 18:57:20 +0000 | [diff] [blame] | 176 | assert(MI.getOpcode() == TargetOpcode::STACKMAP && "exected stackmap"); |
Andrew Trick | d4e3dc6 | 2013-11-19 03:29:56 +0000 | [diff] [blame] | 177 | |
| 178 | int64_t ID = MI.getOperand(0).getImm(); |
Andrew Trick | d4e3dc6 | 2013-11-19 03:29:56 +0000 | [diff] [blame] | 179 | recordStackMapOpers(MI, ID, llvm::next(MI.operands_begin(), 2), |
| 180 | getStackMapEndMOP(MI.operands_begin(), |
| 181 | MI.operands_end())); |
| 182 | } |
| 183 | |
| 184 | void StackMaps::recordPatchPoint(const MachineInstr &MI) { |
Andrew Trick | 7bcb010 | 2013-12-13 18:57:20 +0000 | [diff] [blame] | 185 | assert(MI.getOpcode() == TargetOpcode::PATCHPOINT && "exected stackmap"); |
Andrew Trick | d4e3dc6 | 2013-11-19 03:29:56 +0000 | [diff] [blame] | 186 | |
| 187 | PatchPointOpers opers(&MI); |
| 188 | int64_t ID = opers.getMetaOper(PatchPointOpers::IDPos).getImm(); |
Andrew Trick | e8cba37 | 2013-12-13 18:37:10 +0000 | [diff] [blame] | 189 | |
Andrew Trick | d4e3dc6 | 2013-11-19 03:29:56 +0000 | [diff] [blame] | 190 | MachineInstr::const_mop_iterator MOI = |
| 191 | llvm::next(MI.operands_begin(), opers.getStackMapStartIdx()); |
| 192 | recordStackMapOpers(MI, ID, MOI, getStackMapEndMOP(MOI, MI.operands_end()), |
| 193 | opers.isAnyReg() && opers.hasDef()); |
| 194 | |
| 195 | #ifndef NDEBUG |
| 196 | // verify anyregcc |
| 197 | LocationVec &Locations = CSInfos.back().Locations; |
| 198 | if (opers.isAnyReg()) { |
| 199 | unsigned NArgs = opers.getMetaOper(PatchPointOpers::NArgPos).getImm(); |
| 200 | for (unsigned i = 0, e = (opers.hasDef() ? NArgs+1 : NArgs); i != e; ++i) |
| 201 | assert(Locations[i].LocType == Location::Register && |
| 202 | "anyreg arg must be in reg."); |
| 203 | } |
| 204 | #endif |
| 205 | } |
| 206 | |
Andrew Trick | 153ebe6 | 2013-10-31 22:11:56 +0000 | [diff] [blame] | 207 | /// serializeToStackMapSection conceptually populates the following fields: |
| 208 | /// |
| 209 | /// uint32 : Reserved (header) |
| 210 | /// uint32 : NumConstants |
| 211 | /// int64 : Constants[NumConstants] |
| 212 | /// uint32 : NumRecords |
| 213 | /// StkMapRecord[NumRecords] { |
Andrew Trick | e8cba37 | 2013-12-13 18:37:10 +0000 | [diff] [blame] | 214 | /// uint64 : PatchPoint ID |
Andrew Trick | 153ebe6 | 2013-10-31 22:11:56 +0000 | [diff] [blame] | 215 | /// uint32 : Instruction Offset |
| 216 | /// uint16 : Reserved (record flags) |
| 217 | /// uint16 : NumLocations |
| 218 | /// Location[NumLocations] { |
| 219 | /// uint8 : Register | Direct | Indirect | Constant | ConstantIndex |
Andrew Trick | 10d5be4 | 2013-11-17 01:36:23 +0000 | [diff] [blame] | 220 | /// uint8 : Size in Bytes |
Andrew Trick | 153ebe6 | 2013-10-31 22:11:56 +0000 | [diff] [blame] | 221 | /// uint16 : Dwarf RegNum |
| 222 | /// int32 : Offset |
| 223 | /// } |
| 224 | /// } |
| 225 | /// |
| 226 | /// Location Encoding, Type, Value: |
| 227 | /// 0x1, Register, Reg (value in register) |
| 228 | /// 0x2, Direct, Reg + Offset (frame index) |
| 229 | /// 0x3, Indirect, [Reg + Offset] (spilled value) |
| 230 | /// 0x4, Constant, Offset (small constant) |
| 231 | /// 0x5, ConstIndex, Constants[Offset] (large constant) |
| 232 | /// |
| 233 | void StackMaps::serializeToStackMapSection() { |
| 234 | // Bail out if there's no stack map data. |
| 235 | if (CSInfos.empty()) |
| 236 | return; |
| 237 | |
| 238 | MCContext &OutContext = AP.OutStreamer.getContext(); |
| 239 | const TargetRegisterInfo *TRI = AP.TM.getRegisterInfo(); |
| 240 | |
| 241 | // Create the section. |
| 242 | const MCSection *StackMapSection = |
Lang Hames | 8a06570 | 2013-11-08 22:30:52 +0000 | [diff] [blame] | 243 | OutContext.getObjectFileInfo()->getStackMapSection(); |
Andrew Trick | 153ebe6 | 2013-10-31 22:11:56 +0000 | [diff] [blame] | 244 | AP.OutStreamer.SwitchSection(StackMapSection); |
| 245 | |
| 246 | // Emit a dummy symbol to force section inclusion. |
| 247 | AP.OutStreamer.EmitLabel( |
| 248 | OutContext.GetOrCreateSymbol(Twine("__LLVM_StackMaps"))); |
| 249 | |
| 250 | // Serialize data. |
| 251 | const char *WSMP = "Stack Maps: "; |
Andrew Trick | c21d86f | 2013-10-31 22:42:20 +0000 | [diff] [blame] | 252 | (void)WSMP; |
Andrew Trick | 153ebe6 | 2013-10-31 22:11:56 +0000 | [diff] [blame] | 253 | const MCRegisterInfo &MCRI = *OutContext.getRegisterInfo(); |
| 254 | |
| 255 | DEBUG(dbgs() << "********** Stack Map Output **********\n"); |
| 256 | |
| 257 | // Header. |
| 258 | AP.OutStreamer.EmitIntValue(0, 4); |
| 259 | |
| 260 | // Num constants. |
| 261 | AP.OutStreamer.EmitIntValue(ConstPool.getNumConstants(), 4); |
| 262 | |
| 263 | // Constant pool entries. |
| 264 | for (unsigned i = 0; i < ConstPool.getNumConstants(); ++i) |
| 265 | AP.OutStreamer.EmitIntValue(ConstPool.getConstant(i), 8); |
| 266 | |
| 267 | DEBUG(dbgs() << WSMP << "#callsites = " << CSInfos.size() << "\n"); |
| 268 | AP.OutStreamer.EmitIntValue(CSInfos.size(), 4); |
| 269 | |
| 270 | for (CallsiteInfoList::const_iterator CSII = CSInfos.begin(), |
| 271 | CSIE = CSInfos.end(); |
| 272 | CSII != CSIE; ++CSII) { |
| 273 | |
Andrew Trick | e8cba37 | 2013-12-13 18:37:10 +0000 | [diff] [blame] | 274 | uint64_t CallsiteID = CSII->ID; |
Andrew Trick | 153ebe6 | 2013-10-31 22:11:56 +0000 | [diff] [blame] | 275 | const LocationVec &CSLocs = CSII->Locations; |
| 276 | |
| 277 | DEBUG(dbgs() << WSMP << "callsite " << CallsiteID << "\n"); |
| 278 | |
| 279 | // Verify stack map entry. It's better to communicate a problem to the |
| 280 | // runtime than crash in case of in-process compilation. Currently, we do |
| 281 | // simple overflow checks, but we may eventually communicate other |
| 282 | // compilation errors this way. |
Andrew Trick | 7bcb010 | 2013-12-13 18:57:20 +0000 | [diff] [blame] | 283 | if (CSLocs.size() > UINT16_MAX) { |
| 284 | AP.OutStreamer.EmitIntValue(UINT32_MAX, 8); // Invalid ID. |
Andrew Trick | 153ebe6 | 2013-10-31 22:11:56 +0000 | [diff] [blame] | 285 | AP.OutStreamer.EmitValue(CSII->CSOffsetExpr, 4); |
| 286 | AP.OutStreamer.EmitIntValue(0, 2); // Reserved. |
| 287 | AP.OutStreamer.EmitIntValue(0, 2); // 0 locations. |
| 288 | continue; |
| 289 | } |
| 290 | |
Andrew Trick | e8cba37 | 2013-12-13 18:37:10 +0000 | [diff] [blame] | 291 | AP.OutStreamer.EmitIntValue(CallsiteID, 8); |
Andrew Trick | 153ebe6 | 2013-10-31 22:11:56 +0000 | [diff] [blame] | 292 | AP.OutStreamer.EmitValue(CSII->CSOffsetExpr, 4); |
| 293 | |
| 294 | // Reserved for flags. |
| 295 | AP.OutStreamer.EmitIntValue(0, 2); |
| 296 | |
| 297 | DEBUG(dbgs() << WSMP << " has " << CSLocs.size() << " locations\n"); |
| 298 | |
| 299 | AP.OutStreamer.EmitIntValue(CSLocs.size(), 2); |
| 300 | |
| 301 | unsigned operIdx = 0; |
| 302 | for (LocationVec::const_iterator LocI = CSLocs.begin(), LocE = CSLocs.end(); |
| 303 | LocI != LocE; ++LocI, ++operIdx) { |
| 304 | const Location &Loc = *LocI; |
Lang Hames | fde8e4b | 2013-11-27 20:10:16 +0000 | [diff] [blame] | 305 | unsigned RegNo = 0; |
| 306 | int Offset = Loc.Offset; |
| 307 | if(Loc.Reg) { |
| 308 | RegNo = MCRI.getDwarfRegNum(Loc.Reg, false); |
| 309 | for (MCSuperRegIterator SR(Loc.Reg, TRI); |
| 310 | SR.isValid() && (int)RegNo < 0; ++SR) { |
| 311 | RegNo = TRI->getDwarfRegNum(*SR, false); |
| 312 | } |
| 313 | // If this is a register location, put the subregister byte offset in |
| 314 | // the location offset. |
| 315 | if (Loc.LocType == Location::Register) { |
| 316 | assert(!Loc.Offset && "Register location should have zero offset"); |
| 317 | unsigned LLVMRegNo = MCRI.getLLVMRegNum(RegNo, false); |
| 318 | unsigned SubRegIdx = MCRI.getSubRegIndex(LLVMRegNo, Loc.Reg); |
| 319 | if (SubRegIdx) |
| 320 | Offset = MCRI.getSubRegIdxOffset(SubRegIdx); |
| 321 | } |
| 322 | } |
| 323 | else { |
| 324 | assert(Loc.LocType != Location::Register && |
| 325 | "Missing location register"); |
| 326 | } |
| 327 | |
Andrew Trick | 153ebe6 | 2013-10-31 22:11:56 +0000 | [diff] [blame] | 328 | DEBUG( |
| 329 | dbgs() << WSMP << " Loc " << operIdx << ": "; |
| 330 | switch (Loc.LocType) { |
| 331 | case Location::Unprocessed: |
| 332 | dbgs() << "<Unprocessed operand>"; |
| 333 | break; |
| 334 | case Location::Register: |
| 335 | dbgs() << "Register " << MCRI.getName(Loc.Reg); |
| 336 | break; |
| 337 | case Location::Direct: |
| 338 | dbgs() << "Direct " << MCRI.getName(Loc.Reg); |
| 339 | if (Loc.Offset) |
| 340 | dbgs() << " + " << Loc.Offset; |
| 341 | break; |
| 342 | case Location::Indirect: |
| 343 | dbgs() << "Indirect " << MCRI.getName(Loc.Reg) |
| 344 | << " + " << Loc.Offset; |
| 345 | break; |
| 346 | case Location::Constant: |
| 347 | dbgs() << "Constant " << Loc.Offset; |
| 348 | break; |
| 349 | case Location::ConstantIndex: |
| 350 | dbgs() << "Constant Index " << Loc.Offset; |
| 351 | break; |
| 352 | } |
Lang Hames | fde8e4b | 2013-11-27 20:10:16 +0000 | [diff] [blame] | 353 | dbgs() << " [encoding: .byte " << Loc.LocType |
| 354 | << ", .byte " << Loc.Size |
| 355 | << ", .short " << RegNo |
| 356 | << ", .int " << Offset << "]\n"; |
Andrew Trick | 153ebe6 | 2013-10-31 22:11:56 +0000 | [diff] [blame] | 357 | ); |
| 358 | |
Andrew Trick | 153ebe6 | 2013-10-31 22:11:56 +0000 | [diff] [blame] | 359 | AP.OutStreamer.EmitIntValue(Loc.LocType, 1); |
Andrew Trick | 10d5be4 | 2013-11-17 01:36:23 +0000 | [diff] [blame] | 360 | AP.OutStreamer.EmitIntValue(Loc.Size, 1); |
Andrew Trick | 153ebe6 | 2013-10-31 22:11:56 +0000 | [diff] [blame] | 361 | AP.OutStreamer.EmitIntValue(RegNo, 2); |
Andrew Trick | 10d5be4 | 2013-11-17 01:36:23 +0000 | [diff] [blame] | 362 | AP.OutStreamer.EmitIntValue(Offset, 4); |
Andrew Trick | 153ebe6 | 2013-10-31 22:11:56 +0000 | [diff] [blame] | 363 | } |
Andrew Trick | 153ebe6 | 2013-10-31 22:11:56 +0000 | [diff] [blame] | 364 | } |
| 365 | |
| 366 | AP.OutStreamer.AddBlankLine(); |
| 367 | |
| 368 | CSInfos.clear(); |
| 369 | } |