Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 //===- subzero/src/IceTargetLoweringX8632.cpp - x86-32 lowering -----------===// | 1 //===- subzero/src/IceTargetLoweringX8632.cpp - x86-32 lowering -----------===// |
| 2 // | 2 // |
| 3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
| 4 // | 4 // |
| 5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
| 6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
| 7 // | 7 // |
| 8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
| 9 // | 9 // |
| 10 // This file implements the TargetLoweringX8632 class, which | 10 // This file implements the TargetLoweringX8632 class, which |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 153 { | 153 { |
| 154 // Define a temporary set of enum values based on low-level | 154 // Define a temporary set of enum values based on low-level |
| 155 // table entries. | 155 // table entries. |
| 156 enum _tmp_enum { | 156 enum _tmp_enum { |
| 157 #define X(tag, cvt, sdss, width) _tmp_##tag, | 157 #define X(tag, cvt, sdss, width) _tmp_##tag, |
| 158 ICETYPEX8632_TABLE | 158 ICETYPEX8632_TABLE |
| 159 #undef X | 159 #undef X |
| 160 _num | 160 _num |
| 161 }; | 161 }; |
| 162 // Define a set of constants based on high-level table entries. | 162 // Define a set of constants based on high-level table entries. |
| 163 #define X(tag, size, align, str) static const int _table1_##tag = tag; | 163 #define X(tag, size, align, elts, elty, str) \ |
| 164 static const int _table1_##tag = tag; | |
| 164 ICETYPE_TABLE; | 165 ICETYPE_TABLE; |
| 165 #undef X | 166 #undef X |
| 166 // Define a set of constants based on low-level table entries, | 167 // Define a set of constants based on low-level table entries, |
| 167 // and ensure the table entry keys are consistent. | 168 // and ensure the table entry keys are consistent. |
| 168 #define X(tag, cvt, sdss, width) \ | 169 #define X(tag, cvt, sdss, width) \ |
| 169 static const int _table2_##tag = _tmp_##tag; \ | 170 static const int _table2_##tag = _tmp_##tag; \ |
| 170 STATIC_ASSERT(_table1_##tag == _table2_##tag); | 171 STATIC_ASSERT(_table1_##tag == _table2_##tag); |
| 171 ICETYPEX8632_TABLE; | 172 ICETYPEX8632_TABLE; |
| 172 #undef X | 173 #undef X |
| 173 // Repeat the static asserts with respect to the high-level | 174 // Repeat the static asserts with respect to the high-level |
| 174 // table entries in case the high-level table has extra entries. | 175 // table entries in case the high-level table has extra entries. |
| 175 #define X(tag, size, align, str) STATIC_ASSERT(_table1_##tag == _table2_##tag); | 176 #define X(tag, size, align, elts, elty, str) \ |
| 177 STATIC_ASSERT(_table1_##tag == _table2_##tag); | |
| 176 ICETYPE_TABLE; | 178 ICETYPE_TABLE; |
| 177 #undef X | 179 #undef X |
| 178 } | 180 } |
| 179 } | 181 } |
| 180 | 182 |
| 181 } // end of anonymous namespace | 183 } // end of anonymous namespace |
| 182 | 184 |
| 183 TargetX8632::TargetX8632(Cfg *Func) | 185 TargetX8632::TargetX8632(Cfg *Func) |
| 184 : TargetLowering(Func), IsEbpBasedFrame(false), FrameSizeLocals(0), | 186 : TargetLowering(Func), IsEbpBasedFrame(false), FrameSizeLocals(0), |
| 185 LocalsSizeBytes(0), NextLabelNumber(0), ComputedLiveRanges(false), | 187 LocalsSizeBytes(0), NextLabelNumber(0), ComputedLiveRanges(false), |
| 186 PhysicalRegisters(VarList(Reg_NUM)) { | 188 PhysicalRegisters(VarList(Reg_NUM)) { |
| 187 // TODO: Don't initialize IntegerRegisters and friends every time. | 189 // TODO: Don't initialize IntegerRegisters and friends every time. |
| 188 // Instead, initialize in some sort of static initializer for the | 190 // Instead, initialize in some sort of static initializer for the |
| 189 // class. | 191 // class. |
| 190 llvm::SmallBitVector IntegerRegisters(Reg_NUM); | 192 llvm::SmallBitVector IntegerRegisters(Reg_NUM); |
| 191 llvm::SmallBitVector IntegerRegistersI8(Reg_NUM); | 193 llvm::SmallBitVector IntegerRegistersI8(Reg_NUM); |
| 192 llvm::SmallBitVector FloatRegisters(Reg_NUM); | 194 llvm::SmallBitVector FloatRegisters(Reg_NUM); |
| 195 llvm::SmallBitVector VectorRegisters(Reg_NUM); | |
| 193 llvm::SmallBitVector InvalidRegisters(Reg_NUM); | 196 llvm::SmallBitVector InvalidRegisters(Reg_NUM); |
| 194 ScratchRegs.resize(Reg_NUM); | 197 ScratchRegs.resize(Reg_NUM); |
| 195 #define X(val, init, name, name16, name8, scratch, preserved, stackptr, \ | 198 #define X(val, init, name, name16, name8, scratch, preserved, stackptr, \ |
| 196 frameptr, isI8, isInt, isFP) \ | 199 frameptr, isI8, isInt, isFP) \ |
| 197 IntegerRegisters[val] = isInt; \ | 200 IntegerRegisters[val] = isInt; \ |
| 198 IntegerRegistersI8[val] = isI8; \ | 201 IntegerRegistersI8[val] = isI8; \ |
| 199 FloatRegisters[val] = isFP; \ | 202 FloatRegisters[val] = isFP; \ |
| 203 VectorRegisters[val] = isFP; \ | |
| 200 ScratchRegs[val] = scratch; | 204 ScratchRegs[val] = scratch; |
| 201 REGX8632_TABLE; | 205 REGX8632_TABLE; |
| 202 #undef X | 206 #undef X |
| 203 TypeToRegisterSet[IceType_void] = InvalidRegisters; | 207 TypeToRegisterSet[IceType_void] = InvalidRegisters; |
| 204 TypeToRegisterSet[IceType_i1] = IntegerRegistersI8; | 208 TypeToRegisterSet[IceType_i1] = IntegerRegistersI8; |
| 205 TypeToRegisterSet[IceType_i8] = IntegerRegistersI8; | 209 TypeToRegisterSet[IceType_i8] = IntegerRegistersI8; |
| 206 TypeToRegisterSet[IceType_i16] = IntegerRegisters; | 210 TypeToRegisterSet[IceType_i16] = IntegerRegisters; |
| 207 TypeToRegisterSet[IceType_i32] = IntegerRegisters; | 211 TypeToRegisterSet[IceType_i32] = IntegerRegisters; |
| 208 TypeToRegisterSet[IceType_i64] = IntegerRegisters; | 212 TypeToRegisterSet[IceType_i64] = IntegerRegisters; |
| 209 TypeToRegisterSet[IceType_f32] = FloatRegisters; | 213 TypeToRegisterSet[IceType_f32] = FloatRegisters; |
| 210 TypeToRegisterSet[IceType_f64] = FloatRegisters; | 214 TypeToRegisterSet[IceType_f64] = FloatRegisters; |
| 215 TypeToRegisterSet[IceType_v4i1] = VectorRegisters; | |
| 216 TypeToRegisterSet[IceType_v8i1] = VectorRegisters; | |
| 217 TypeToRegisterSet[IceType_v16i1] = VectorRegisters; | |
| 218 TypeToRegisterSet[IceType_v16i8] = VectorRegisters; | |
| 219 TypeToRegisterSet[IceType_v8i16] = VectorRegisters; | |
| 220 TypeToRegisterSet[IceType_v4i32] = VectorRegisters; | |
| 221 TypeToRegisterSet[IceType_v4f32] = VectorRegisters; | |
| 211 } | 222 } |
| 212 | 223 |
| 213 void TargetX8632::translateO2() { | 224 void TargetX8632::translateO2() { |
| 214 GlobalContext *Context = Func->getContext(); | 225 GlobalContext *Context = Func->getContext(); |
| 215 | 226 |
| 216 // Lower Phi instructions. | 227 // Lower Phi instructions. |
| 217 Timer T_placePhiLoads; | 228 Timer T_placePhiLoads; |
| 218 Func->placePhiLoads(); | 229 Func->placePhiLoads(); |
| 219 if (Func->hasError()) | 230 if (Func->hasError()) |
| 220 return; | 231 return; |
| (...skipping 1069 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1290 } | 1301 } |
| 1291 StackOffset += typeWidthInBytesOnStack(Arg->getType()); | 1302 StackOffset += typeWidthInBytesOnStack(Arg->getType()); |
| 1292 } | 1303 } |
| 1293 // Generate the call instruction. Assign its result to a temporary | 1304 // Generate the call instruction. Assign its result to a temporary |
| 1294 // with high register allocation weight. | 1305 // with high register allocation weight. |
| 1295 Variable *Dest = Instr->getDest(); | 1306 Variable *Dest = Instr->getDest(); |
| 1296 Variable *eax = NULL; // doubles as RegLo as necessary | 1307 Variable *eax = NULL; // doubles as RegLo as necessary |
| 1297 Variable *edx = NULL; | 1308 Variable *edx = NULL; |
| 1298 if (Dest) { | 1309 if (Dest) { |
| 1299 switch (Dest->getType()) { | 1310 switch (Dest->getType()) { |
| 1311 case IceType_v4i1: | |
| 1312 case IceType_v8i1: | |
| 1313 case IceType_v16i1: | |
| 1314 case IceType_v16i8: | |
| 1315 case IceType_v8i16: | |
| 1316 case IceType_v4i32: | |
| 1317 case IceType_v4f32: | |
|
JF
2014/06/30 22:24:04
I'm not sure I understand correctly, but this seem
wala
2014/06/30 22:47:40
This will be implemented, along with the rest of t
| |
| 1300 case IceType_NUM: | 1318 case IceType_NUM: |
| 1301 llvm_unreachable("Invalid Call dest type"); | 1319 llvm_unreachable("Invalid Call dest type"); |
| 1302 break; | 1320 break; |
| 1303 case IceType_void: | 1321 case IceType_void: |
| 1304 break; | 1322 break; |
| 1305 case IceType_i1: | 1323 case IceType_i1: |
| 1306 case IceType_i8: | 1324 case IceType_i8: |
| 1307 case IceType_i16: | 1325 case IceType_i16: |
| 1308 case IceType_i32: | 1326 case IceType_i32: |
| 1309 eax = makeReg(Dest->getType(), Reg_eax); | 1327 eax = makeReg(Dest->getType(), Reg_eax); |
| (...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2266 if (Inst->hasRetValue()) { | 2284 if (Inst->hasRetValue()) { |
| 2267 Operand *Src0 = legalize(Inst->getRetValue()); | 2285 Operand *Src0 = legalize(Inst->getRetValue()); |
| 2268 if (Src0->getType() == IceType_i64) { | 2286 if (Src0->getType() == IceType_i64) { |
| 2269 Variable *eax = legalizeToVar(loOperand(Src0), false, Reg_eax); | 2287 Variable *eax = legalizeToVar(loOperand(Src0), false, Reg_eax); |
| 2270 Variable *edx = legalizeToVar(hiOperand(Src0), false, Reg_edx); | 2288 Variable *edx = legalizeToVar(hiOperand(Src0), false, Reg_edx); |
| 2271 Reg = eax; | 2289 Reg = eax; |
| 2272 Context.insert(InstFakeUse::create(Func, edx)); | 2290 Context.insert(InstFakeUse::create(Func, edx)); |
| 2273 } else if (Src0->getType() == IceType_f32 || | 2291 } else if (Src0->getType() == IceType_f32 || |
| 2274 Src0->getType() == IceType_f64) { | 2292 Src0->getType() == IceType_f64) { |
| 2275 _fld(Src0); | 2293 _fld(Src0); |
| 2294 } else if (isVectorType(Src0->getType())) { | |
| 2295 Reg = legalizeToVar(Src0, false, Reg_xmm0); | |
| 2276 } else { | 2296 } else { |
| 2277 _mov(Reg, Src0, Reg_eax); | 2297 _mov(Reg, Src0, Reg_eax); |
| 2278 } | 2298 } |
| 2279 } | 2299 } |
| 2280 _ret(Reg); | 2300 _ret(Reg); |
| 2281 // Add a fake use of esp to make sure esp stays alive for the entire | 2301 // Add a fake use of esp to make sure esp stays alive for the entire |
| 2282 // function. Otherwise post-call esp adjustments get dead-code | 2302 // function. Otherwise post-call esp adjustments get dead-code |
| 2283 // eliminated. TODO: Are there more places where the fake use | 2303 // eliminated. TODO: Are there more places where the fake use |
| 2284 // should be inserted? E.g. "void f(int n){while(1) g(n);}" may not | 2304 // should be inserted? E.g. "void f(int n){while(1) g(n);}" may not |
| 2285 // have a ret instruction. | 2305 // have a ret instruction. |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2387 _br(Inst->getLabelDefault()); | 2407 _br(Inst->getLabelDefault()); |
| 2388 } | 2408 } |
| 2389 | 2409 |
| 2390 void TargetX8632::lowerUnreachable(const InstUnreachable * /*Inst*/) { | 2410 void TargetX8632::lowerUnreachable(const InstUnreachable * /*Inst*/) { |
| 2391 const SizeT MaxSrcs = 0; | 2411 const SizeT MaxSrcs = 0; |
| 2392 Variable *Dest = NULL; | 2412 Variable *Dest = NULL; |
| 2393 InstCall *Call = makeHelperCall("ice_unreachable", Dest, MaxSrcs); | 2413 InstCall *Call = makeHelperCall("ice_unreachable", Dest, MaxSrcs); |
| 2394 lowerCall(Call); | 2414 lowerCall(Call); |
| 2395 } | 2415 } |
| 2396 | 2416 |
| 2417 // Helper for legalize() to emit the right code to lower an operand to a | |
| 2418 // register of the appropriate type. | |
| 2419 Variable *TargetX8632::copyToReg(Operand *Src, int32_t RegNum) { | |
| 2420 Type Ty = Src->getType(); | |
| 2421 Variable *Reg = makeReg(Ty, RegNum); | |
| 2422 if (isVectorType(Src->getType())) { | |
| 2423 _movp(Reg, Src); | |
| 2424 } else { | |
| 2425 _mov(Reg, Src); | |
| 2426 } | |
| 2427 return Reg; | |
| 2428 } | |
| 2429 | |
| 2397 Operand *TargetX8632::legalize(Operand *From, LegalMask Allowed, | 2430 Operand *TargetX8632::legalize(Operand *From, LegalMask Allowed, |
| 2398 bool AllowOverlap, int32_t RegNum) { | 2431 bool AllowOverlap, int32_t RegNum) { |
| 2399 // Assert that a physical register is allowed. To date, all calls | 2432 // Assert that a physical register is allowed. To date, all calls |
| 2400 // to legalize() allow a physical register. If a physical register | 2433 // to legalize() allow a physical register. If a physical register |
| 2401 // needs to be explicitly disallowed, then new code will need to be | 2434 // needs to be explicitly disallowed, then new code will need to be |
| 2402 // written to force a spill. | 2435 // written to force a spill. |
| 2403 assert(Allowed & Legal_Reg); | 2436 assert(Allowed & Legal_Reg); |
| 2404 // If we're asking for a specific physical register, make sure we're | 2437 // If we're asking for a specific physical register, make sure we're |
| 2405 // not allowing any other operand kinds. (This could be future | 2438 // not allowing any other operand kinds. (This could be future |
| 2406 // work, e.g. allow the shl shift amount to be either an immediate | 2439 // work, e.g. allow the shl shift amount to be either an immediate |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 2419 if (Index) { | 2452 if (Index) { |
| 2420 RegIndex = legalizeToVar(Index, true); | 2453 RegIndex = legalizeToVar(Index, true); |
| 2421 } | 2454 } |
| 2422 if (Base != RegBase || Index != RegIndex) { | 2455 if (Base != RegBase || Index != RegIndex) { |
| 2423 From = OperandX8632Mem::create( | 2456 From = OperandX8632Mem::create( |
| 2424 Func, Mem->getType(), RegBase, Mem->getOffset(), RegIndex, | 2457 Func, Mem->getType(), RegBase, Mem->getOffset(), RegIndex, |
| 2425 Mem->getShift(), Mem->getSegmentRegister()); | 2458 Mem->getShift(), Mem->getSegmentRegister()); |
| 2426 } | 2459 } |
| 2427 | 2460 |
| 2428 if (!(Allowed & Legal_Mem)) { | 2461 if (!(Allowed & Legal_Mem)) { |
| 2429 Variable *Reg = makeReg(From->getType(), RegNum); | 2462 From = copyToReg(From, RegNum); |
| 2430 _mov(Reg, From, RegNum); | |
| 2431 From = Reg; | |
| 2432 } | 2463 } |
| 2433 return From; | 2464 return From; |
| 2434 } | 2465 } |
| 2435 if (llvm::isa<Constant>(From)) { | 2466 if (llvm::isa<Constant>(From)) { |
| 2436 if (llvm::isa<ConstantUndef>(From)) { | 2467 if (llvm::isa<ConstantUndef>(From)) { |
| 2437 // Lower undefs to zero. Another option is to lower undefs to an | 2468 // Lower undefs to zero. Another option is to lower undefs to an |
| 2438 // uninitialized register; however, using an uninitialized register | 2469 // uninitialized register; however, using an uninitialized register |
| 2439 // results in less predictable code. | 2470 // results in less predictable code. |
| 2440 // | 2471 // |
| 2441 // If in the future the implementation is changed to lower undef | 2472 // If in the future the implementation is changed to lower undef |
| 2442 // values to uninitialized registers, a FakeDef will be needed: | 2473 // values to uninitialized registers, a FakeDef will be needed: |
| 2443 // Context.insert(InstFakeDef::create(Func, Reg)); | 2474 // Context.insert(InstFakeDef::create(Func, Reg)); |
| 2444 // This is in order to ensure that the live range of Reg is not | 2475 // This is in order to ensure that the live range of Reg is not |
| 2445 // overestimated. If the constant being lowered is a 64 bit value, | 2476 // overestimated. If the constant being lowered is a 64 bit value, |
| 2446 // then the result should be split and the lo and hi components will | 2477 // then the result should be split and the lo and hi components will |
| 2447 // need to go in uninitialized registers. | 2478 // need to go in uninitialized registers. |
| 2448 From = Ctx->getConstantZero(From->getType()); | 2479 |
| 2480 if (isVectorType(From->getType())) { | |
| 2481 // There is no support for loading or emitting vector constants, so | |
| 2482 // undef values are instead initialized in registers. | |
| 2483 Variable *Reg = makeReg(From->getType(), RegNum); | |
| 2484 // Insert a FakeDef, since otherwise the live range of Reg might | |
| 2485 // be overestimated. | |
| 2486 Context.insert(InstFakeDef::create(Func, Reg)); | |
| 2487 _pxor(Reg, Reg); | |
| 2488 return Reg; | |
| 2489 } else { | |
| 2490 From = Ctx->getConstantZero(From->getType()); | |
| 2491 } | |
| 2449 } | 2492 } |
| 2450 bool NeedsReg = false; | 2493 bool NeedsReg = false; |
| 2451 if (!(Allowed & Legal_Imm)) | 2494 if (!(Allowed & Legal_Imm)) |
| 2452 // Immediate specifically not allowed | 2495 // Immediate specifically not allowed |
| 2453 NeedsReg = true; | 2496 NeedsReg = true; |
| 2454 // TODO(stichnot): LEAHACK: remove Legal_Reloc once a proper | 2497 // TODO(stichnot): LEAHACK: remove Legal_Reloc once a proper |
| 2455 // emitter is used. | 2498 // emitter is used. |
| 2456 if (!(Allowed & Legal_Reloc) && llvm::isa<ConstantRelocatable>(From)) | 2499 if (!(Allowed & Legal_Reloc) && llvm::isa<ConstantRelocatable>(From)) |
| 2457 // Relocatable specifically not allowed | 2500 // Relocatable specifically not allowed |
| 2458 NeedsReg = true; | 2501 NeedsReg = true; |
| 2459 if (!(Allowed & Legal_Mem) && | 2502 if (!(Allowed & Legal_Mem) && |
| 2460 (From->getType() == IceType_f32 || From->getType() == IceType_f64)) | 2503 (From->getType() == IceType_f32 || From->getType() == IceType_f64)) |
| 2461 // On x86, FP constants are lowered to mem operands. | 2504 // On x86, FP constants are lowered to mem operands. |
| 2462 NeedsReg = true; | 2505 NeedsReg = true; |
| 2463 if (NeedsReg) { | 2506 if (NeedsReg) { |
| 2464 Variable *Reg = makeReg(From->getType(), RegNum); | 2507 From = copyToReg(From, RegNum); |
| 2465 _mov(Reg, From); | |
| 2466 From = Reg; | |
| 2467 } | 2508 } |
| 2468 return From; | 2509 return From; |
| 2469 } | 2510 } |
| 2470 if (Variable *Var = llvm::dyn_cast<Variable>(From)) { | 2511 if (Variable *Var = llvm::dyn_cast<Variable>(From)) { |
| 2471 // We need a new physical register for the operand if: | 2512 // We need a new physical register for the operand if: |
| 2472 // Mem is not allowed and Var->getRegNum() is unknown, or | 2513 // Mem is not allowed and Var->getRegNum() is unknown, or |
| 2473 // RegNum is required and Var->getRegNum() doesn't match. | 2514 // RegNum is required and Var->getRegNum() doesn't match. |
| 2474 if ((!(Allowed & Legal_Mem) && !Var->hasReg()) || | 2515 if ((!(Allowed & Legal_Mem) && !Var->hasReg()) || |
| 2475 (RegNum != Variable::NoRegister && RegNum != Var->getRegNum())) { | 2516 (RegNum != Variable::NoRegister && RegNum != Var->getRegNum())) { |
| 2476 Variable *Reg = makeReg(From->getType(), RegNum); | 2517 Variable *Reg = copyToReg(From, RegNum); |
| 2477 if (RegNum == Variable::NoRegister) { | 2518 if (RegNum == Variable::NoRegister) { |
| 2478 Reg->setPreferredRegister(Var, AllowOverlap); | 2519 Reg->setPreferredRegister(Var, AllowOverlap); |
| 2479 } | 2520 } |
| 2480 _mov(Reg, From); | |
| 2481 From = Reg; | 2521 From = Reg; |
| 2482 } | 2522 } |
| 2483 return From; | 2523 return From; |
| 2484 } | 2524 } |
| 2485 llvm_unreachable("Unhandled operand kind in legalize()"); | 2525 llvm_unreachable("Unhandled operand kind in legalize()"); |
| 2486 return From; | 2526 return From; |
| 2487 } | 2527 } |
| 2488 | 2528 |
| 2489 // Provide a trivial wrapper to legalize() for this common usage. | 2529 // Provide a trivial wrapper to legalize() for this common usage. |
| 2490 Variable *TargetX8632::legalizeToVar(Operand *From, bool AllowOverlap, | 2530 Variable *TargetX8632::legalizeToVar(Operand *From, bool AllowOverlap, |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2572 } | 2612 } |
| 2573 assert(AvailableTypedRegisters.any()); | 2613 assert(AvailableTypedRegisters.any()); |
| 2574 int32_t RegNum = AvailableTypedRegisters.find_first(); | 2614 int32_t RegNum = AvailableTypedRegisters.find_first(); |
| 2575 Var->setRegNum(RegNum); | 2615 Var->setRegNum(RegNum); |
| 2576 AvailableRegisters[RegNum] = false; | 2616 AvailableRegisters[RegNum] = false; |
| 2577 } | 2617 } |
| 2578 } | 2618 } |
| 2579 } | 2619 } |
| 2580 } | 2620 } |
| 2581 | 2621 |
| 2622 template <> void ConstantInteger::emit(GlobalContext *Ctx) const { | |
| 2623 Ostream &Str = Ctx->getStrEmit(); | |
| 2624 Str << getValue(); | |
| 2625 } | |
| 2626 | |
| 2582 template <> void ConstantFloat::emit(GlobalContext *Ctx) const { | 2627 template <> void ConstantFloat::emit(GlobalContext *Ctx) const { |
| 2583 Ostream &Str = Ctx->getStrEmit(); | 2628 Ostream &Str = Ctx->getStrEmit(); |
| 2584 // It would be better to prefix with ".L$" instead of "L$", but | 2629 // It would be better to prefix with ".L$" instead of "L$", but |
| 2585 // llvm-mc doesn't parse "dword ptr [.L$foo]". | 2630 // llvm-mc doesn't parse "dword ptr [.L$foo]". |
| 2586 Str << "dword ptr [L$" << IceType_f32 << "$" << getPoolEntryID() << "]"; | 2631 Str << "dword ptr [L$" << IceType_f32 << "$" << getPoolEntryID() << "]"; |
| 2587 } | 2632 } |
| 2588 | 2633 |
| 2589 template <> void ConstantDouble::emit(GlobalContext *Ctx) const { | 2634 template <> void ConstantDouble::emit(GlobalContext *Ctx) const { |
| 2590 Ostream &Str = Ctx->getStrEmit(); | 2635 Ostream &Str = Ctx->getStrEmit(); |
| 2591 Str << "qword ptr [L$" << IceType_f64 << "$" << getPoolEntryID() << "]"; | 2636 Str << "qword ptr [L$" << IceType_f64 << "$" << getPoolEntryID() << "]"; |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2681 for (SizeT i = 0; i < Size; ++i) { | 2726 for (SizeT i = 0; i < Size; ++i) { |
| 2682 Str << "\t.byte\t" << (((unsigned)Data[i]) & 0xff) << "\n"; | 2727 Str << "\t.byte\t" << (((unsigned)Data[i]) & 0xff) << "\n"; |
| 2683 } | 2728 } |
| 2684 Str << "\t.size\t" << MangledName << ", " << Size << "\n"; | 2729 Str << "\t.size\t" << MangledName << ", " << Size << "\n"; |
| 2685 } | 2730 } |
| 2686 Str << "\t" << (IsInternal ? ".local" : ".global") << "\t" << MangledName | 2731 Str << "\t" << (IsInternal ? ".local" : ".global") << "\t" << MangledName |
| 2687 << "\n"; | 2732 << "\n"; |
| 2688 } | 2733 } |
| 2689 | 2734 |
| 2690 } // end of namespace Ice | 2735 } // end of namespace Ice |
| OLD | NEW |