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 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 446 | 446 |
| 447 Variable *TargetX8632::getPhysicalRegister(SizeT RegNum) { | 447 Variable *TargetX8632::getPhysicalRegister(SizeT RegNum) { |
| 448 assert(RegNum < PhysicalRegisters.size()); | 448 assert(RegNum < PhysicalRegisters.size()); |
| 449 Variable *Reg = PhysicalRegisters[RegNum]; | 449 Variable *Reg = PhysicalRegisters[RegNum]; |
| 450 if (Reg == NULL) { | 450 if (Reg == NULL) { |
| 451 Reg = Func->makeVariable(IceType_i32); | 451 Reg = Func->makeVariable(IceType_i32); |
| 452 Reg->setRegNum(RegNum); | 452 Reg->setRegNum(RegNum); |
| 453 PhysicalRegisters[RegNum] = Reg; | 453 PhysicalRegisters[RegNum] = Reg; |
| 454 // Specially mark esp as an "argument" so that it is considered | 454 // Specially mark esp as an "argument" so that it is considered |
| 455 // live upon function entry. | 455 // live upon function entry. |
| 456 if (RegNum == RegX8632::Reg_esp) | 456 if (RegNum == RegX8632::Reg_esp) { |
| 457 Func->addImplicitArg(Reg); | 457 Func->addImplicitArg(Reg); |
| 458 Reg->setIgnoreLiveness(); | |
| 459 } | |
| 458 } | 460 } |
| 459 return Reg; | 461 return Reg; |
| 460 } | 462 } |
| 461 | 463 |
| 462 IceString TargetX8632::getRegName(SizeT RegNum, Type Ty) const { | 464 IceString TargetX8632::getRegName(SizeT RegNum, Type Ty) const { |
| 463 assert(RegNum < RegX8632::Reg_NUM); | 465 assert(RegNum < RegX8632::Reg_NUM); |
| 464 static IceString RegNames8[] = { | 466 static IceString RegNames8[] = { |
| 465 #define X(val, encode, name, name16, name8, scratch, preserved, stackptr, \ | 467 #define X(val, encode, name, name16, name8, scratch, preserved, stackptr, \ |
| 466 frameptr, isI8, isInt, isFP) \ | 468 frameptr, isI8, isInt, isFP) \ |
| 467 name8, | 469 name8, |
| (...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1251 InstX8632Label *Label = InstX8632Label::create(Func, this); | 1253 InstX8632Label *Label = InstX8632Label::create(Func, this); |
| 1252 _mov(T_1, Src1Lo, RegX8632::Reg_ecx); | 1254 _mov(T_1, Src1Lo, RegX8632::Reg_ecx); |
| 1253 _mov(T_2, Src0Lo); | 1255 _mov(T_2, Src0Lo); |
| 1254 _mov(T_3, Src0Hi); | 1256 _mov(T_3, Src0Hi); |
| 1255 _shld(T_3, T_2, T_1); | 1257 _shld(T_3, T_2, T_1); |
| 1256 _shl(T_2, T_1); | 1258 _shl(T_2, T_1); |
| 1257 _test(T_1, BitTest); | 1259 _test(T_1, BitTest); |
| 1258 _br(CondX86::Br_e, Label); | 1260 _br(CondX86::Br_e, Label); |
| 1259 // Because of the intra-block control flow, we need to fake a use | 1261 // Because of the intra-block control flow, we need to fake a use |
| 1260 // of T_3 to prevent its earlier definition from being dead-code | 1262 // of T_3 to prevent its earlier definition from being dead-code |
| 1261 // eliminated in the presence of its later definition. | 1263 // eliminated in the presence of its later definition. |
|
jvoung (off chromium)
2014/10/13 20:50:50
Now that the fakeuse is removed, can the comment b
Jim Stichnoth
2014/10/13 23:15:22
Done.
| |
| 1262 Context.insert(InstFakeUse::create(Func, T_3)); | 1264 _mov_nonkillable(T_3, T_2); |
| 1263 _mov(T_3, T_2); | 1265 _mov_nonkillable(T_2, Zero); |
| 1264 _mov(T_2, Zero); | |
| 1265 Context.insert(Label); | 1266 Context.insert(Label); |
| 1266 _mov(DestLo, T_2); | 1267 _mov(DestLo, T_2); |
| 1267 _mov(DestHi, T_3); | 1268 _mov(DestHi, T_3); |
| 1268 } break; | 1269 } break; |
| 1269 case InstArithmetic::Lshr: { | 1270 case InstArithmetic::Lshr: { |
| 1270 // a=b>>c (unsigned) ==> | 1271 // a=b>>c (unsigned) ==> |
| 1271 // t1:ecx = c.lo & 0xff | 1272 // t1:ecx = c.lo & 0xff |
| 1272 // t2 = b.lo | 1273 // t2 = b.lo |
| 1273 // t3 = b.hi | 1274 // t3 = b.hi |
| 1274 // t2 = shrd t2, t3, t1 | 1275 // t2 = shrd t2, t3, t1 |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 1288 _mov(T_1, Src1Lo, RegX8632::Reg_ecx); | 1289 _mov(T_1, Src1Lo, RegX8632::Reg_ecx); |
| 1289 _mov(T_2, Src0Lo); | 1290 _mov(T_2, Src0Lo); |
| 1290 _mov(T_3, Src0Hi); | 1291 _mov(T_3, Src0Hi); |
| 1291 _shrd(T_2, T_3, T_1); | 1292 _shrd(T_2, T_3, T_1); |
| 1292 _shr(T_3, T_1); | 1293 _shr(T_3, T_1); |
| 1293 _test(T_1, BitTest); | 1294 _test(T_1, BitTest); |
| 1294 _br(CondX86::Br_e, Label); | 1295 _br(CondX86::Br_e, Label); |
| 1295 // Because of the intra-block control flow, we need to fake a use | 1296 // Because of the intra-block control flow, we need to fake a use |
| 1296 // of T_3 to prevent its earlier definition from being dead-code | 1297 // of T_3 to prevent its earlier definition from being dead-code |
| 1297 // eliminated in the presence of its later definition. | 1298 // eliminated in the presence of its later definition. |
| 1298 Context.insert(InstFakeUse::create(Func, T_2)); | 1299 _mov_nonkillable(T_2, T_3); |
| 1299 _mov(T_2, T_3); | 1300 _mov_nonkillable(T_3, Zero); |
| 1300 _mov(T_3, Zero); | |
| 1301 Context.insert(Label); | 1301 Context.insert(Label); |
| 1302 _mov(DestLo, T_2); | 1302 _mov(DestLo, T_2); |
| 1303 _mov(DestHi, T_3); | 1303 _mov(DestHi, T_3); |
| 1304 } break; | 1304 } break; |
| 1305 case InstArithmetic::Ashr: { | 1305 case InstArithmetic::Ashr: { |
| 1306 // a=b>>c (signed) ==> | 1306 // a=b>>c (signed) ==> |
| 1307 // t1:ecx = c.lo & 0xff | 1307 // t1:ecx = c.lo & 0xff |
| 1308 // t2 = b.lo | 1308 // t2 = b.lo |
| 1309 // t3 = b.hi | 1309 // t3 = b.hi |
| 1310 // t2 = shrd t2, t3, t1 | 1310 // t2 = shrd t2, t3, t1 |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 1324 _mov(T_1, Src1Lo, RegX8632::Reg_ecx); | 1324 _mov(T_1, Src1Lo, RegX8632::Reg_ecx); |
| 1325 _mov(T_2, Src0Lo); | 1325 _mov(T_2, Src0Lo); |
| 1326 _mov(T_3, Src0Hi); | 1326 _mov(T_3, Src0Hi); |
| 1327 _shrd(T_2, T_3, T_1); | 1327 _shrd(T_2, T_3, T_1); |
| 1328 _sar(T_3, T_1); | 1328 _sar(T_3, T_1); |
| 1329 _test(T_1, BitTest); | 1329 _test(T_1, BitTest); |
| 1330 _br(CondX86::Br_e, Label); | 1330 _br(CondX86::Br_e, Label); |
| 1331 // Because of the intra-block control flow, we need to fake a use | 1331 // Because of the intra-block control flow, we need to fake a use |
| 1332 // of T_3 to prevent its earlier definition from being dead-code | 1332 // of T_3 to prevent its earlier definition from being dead-code |
| 1333 // eliminated in the presence of its later definition. | 1333 // eliminated in the presence of its later definition. |
| 1334 Context.insert(InstFakeUse::create(Func, T_2)); | 1334 _mov_nonkillable(T_2, T_3); |
| 1335 _mov(T_2, T_3); | |
| 1336 _sar(T_3, SignExtend); | 1335 _sar(T_3, SignExtend); |
| 1337 Context.insert(Label); | 1336 Context.insert(Label); |
| 1338 _mov(DestLo, T_2); | 1337 _mov(DestLo, T_2); |
| 1339 _mov(DestHi, T_3); | 1338 _mov(DestHi, T_3); |
| 1340 } break; | 1339 } break; |
| 1341 case InstArithmetic::Udiv: { | 1340 case InstArithmetic::Udiv: { |
| 1342 const SizeT MaxSrcs = 2; | 1341 const SizeT MaxSrcs = 2; |
| 1343 InstCall *Call = makeHelperCall("__udivdi3", Dest, MaxSrcs); | 1342 InstCall *Call = makeHelperCall("__udivdi3", Dest, MaxSrcs); |
| 1344 Call->addArg(Inst->getSrc(0)); | 1343 Call->addArg(Inst->getSrc(0)); |
| 1345 Call->addArg(Inst->getSrc(1)); | 1344 Call->addArg(Inst->getSrc(1)); |
| (...skipping 1162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2508 } | 2507 } |
| 2509 Constant *Default = | 2508 Constant *Default = |
| 2510 Ctx->getConstantInt32(IceType_i32, TableFcmp[Index].Default); | 2509 Ctx->getConstantInt32(IceType_i32, TableFcmp[Index].Default); |
| 2511 _mov(Dest, Default); | 2510 _mov(Dest, Default); |
| 2512 if (HasC1) { | 2511 if (HasC1) { |
| 2513 InstX8632Label *Label = InstX8632Label::create(Func, this); | 2512 InstX8632Label *Label = InstX8632Label::create(Func, this); |
| 2514 _br(TableFcmp[Index].C1, Label); | 2513 _br(TableFcmp[Index].C1, Label); |
| 2515 if (HasC2) { | 2514 if (HasC2) { |
| 2516 _br(TableFcmp[Index].C2, Label); | 2515 _br(TableFcmp[Index].C2, Label); |
| 2517 } | 2516 } |
| 2518 Context.insert(InstFakeUse::create(Func, Dest)); | |
| 2519 Constant *NonDefault = | 2517 Constant *NonDefault = |
| 2520 Ctx->getConstantInt32(IceType_i32, !TableFcmp[Index].Default); | 2518 Ctx->getConstantInt32(IceType_i32, !TableFcmp[Index].Default); |
| 2521 _mov(Dest, NonDefault); | 2519 _mov_nonkillable(Dest, NonDefault); |
| 2522 Context.insert(Label); | 2520 Context.insert(Label); |
| 2523 } | 2521 } |
| 2524 } | 2522 } |
| 2525 | 2523 |
| 2526 void TargetX8632::lowerIcmp(const InstIcmp *Inst) { | 2524 void TargetX8632::lowerIcmp(const InstIcmp *Inst) { |
| 2527 Operand *Src0 = legalize(Inst->getSrc(0)); | 2525 Operand *Src0 = legalize(Inst->getSrc(0)); |
| 2528 Operand *Src1 = legalize(Inst->getSrc(1)); | 2526 Operand *Src1 = legalize(Inst->getSrc(1)); |
| 2529 Variable *Dest = Inst->getDest(); | 2527 Variable *Dest = Inst->getDest(); |
| 2530 | 2528 |
| 2531 if (isVectorType(Dest->getType())) { | 2529 if (isVectorType(Dest->getType())) { |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2667 Operand *Src0HiRM = legalize(hiOperand(Src0), Legal_Reg | Legal_Mem); | 2665 Operand *Src0HiRM = legalize(hiOperand(Src0), Legal_Reg | Legal_Mem); |
| 2668 Operand *Src1LoRI = legalize(loOperand(Src1), Legal_Reg | Legal_Imm); | 2666 Operand *Src1LoRI = legalize(loOperand(Src1), Legal_Reg | Legal_Imm); |
| 2669 Operand *Src1HiRI = legalize(hiOperand(Src1), Legal_Reg | Legal_Imm); | 2667 Operand *Src1HiRI = legalize(hiOperand(Src1), Legal_Reg | Legal_Imm); |
| 2670 if (Condition == InstIcmp::Eq || Condition == InstIcmp::Ne) { | 2668 if (Condition == InstIcmp::Eq || Condition == InstIcmp::Ne) { |
| 2671 InstX8632Label *Label = InstX8632Label::create(Func, this); | 2669 InstX8632Label *Label = InstX8632Label::create(Func, this); |
| 2672 _mov(Dest, (Condition == InstIcmp::Eq ? Zero : One)); | 2670 _mov(Dest, (Condition == InstIcmp::Eq ? Zero : One)); |
| 2673 _cmp(Src0LoRM, Src1LoRI); | 2671 _cmp(Src0LoRM, Src1LoRI); |
| 2674 _br(CondX86::Br_ne, Label); | 2672 _br(CondX86::Br_ne, Label); |
| 2675 _cmp(Src0HiRM, Src1HiRI); | 2673 _cmp(Src0HiRM, Src1HiRI); |
| 2676 _br(CondX86::Br_ne, Label); | 2674 _br(CondX86::Br_ne, Label); |
| 2677 Context.insert(InstFakeUse::create(Func, Dest)); | 2675 _mov_nonkillable(Dest, (Condition == InstIcmp::Eq ? One : Zero)); |
| 2678 _mov(Dest, (Condition == InstIcmp::Eq ? One : Zero)); | |
| 2679 Context.insert(Label); | 2676 Context.insert(Label); |
| 2680 } else { | 2677 } else { |
| 2681 InstX8632Label *LabelFalse = InstX8632Label::create(Func, this); | 2678 InstX8632Label *LabelFalse = InstX8632Label::create(Func, this); |
| 2682 InstX8632Label *LabelTrue = InstX8632Label::create(Func, this); | 2679 InstX8632Label *LabelTrue = InstX8632Label::create(Func, this); |
| 2683 _mov(Dest, One); | 2680 _mov(Dest, One); |
| 2684 _cmp(Src0HiRM, Src1HiRI); | 2681 _cmp(Src0HiRM, Src1HiRI); |
| 2685 _br(TableIcmp64[Index].C1, LabelTrue); | 2682 _br(TableIcmp64[Index].C1, LabelTrue); |
| 2686 _br(TableIcmp64[Index].C2, LabelFalse); | 2683 _br(TableIcmp64[Index].C2, LabelFalse); |
| 2687 _cmp(Src0LoRM, Src1LoRI); | 2684 _cmp(Src0LoRM, Src1LoRI); |
| 2688 _br(TableIcmp64[Index].C3, LabelTrue); | 2685 _br(TableIcmp64[Index].C3, LabelTrue); |
| 2689 Context.insert(LabelFalse); | 2686 Context.insert(LabelFalse); |
| 2690 Context.insert(InstFakeUse::create(Func, Dest)); | 2687 _mov_nonkillable(Dest, Zero); |
| 2691 _mov(Dest, Zero); | |
| 2692 Context.insert(LabelTrue); | 2688 Context.insert(LabelTrue); |
| 2693 } | 2689 } |
| 2694 return; | 2690 return; |
| 2695 } | 2691 } |
| 2696 | 2692 |
| 2697 // cmp b, c | 2693 // cmp b, c |
| 2698 Operand *Src0RM = | 2694 Operand *Src0RM = |
| 2699 legalize(Src0, IsSrc1ImmOrReg ? (Legal_Reg | Legal_Mem) : Legal_Reg); | 2695 legalize(Src0, IsSrc1ImmOrReg ? (Legal_Reg | Legal_Mem) : Legal_Reg); |
| 2700 InstX8632Label *Label = InstX8632Label::create(Func, this); | 2696 InstX8632Label *Label = InstX8632Label::create(Func, this); |
| 2701 _cmp(Src0RM, Src1); | 2697 _cmp(Src0RM, Src1); |
| 2702 _mov(Dest, One); | 2698 _mov(Dest, One); |
| 2703 _br(getIcmp32Mapping(Inst->getCondition()), Label); | 2699 _br(getIcmp32Mapping(Inst->getCondition()), Label); |
| 2704 Context.insert(InstFakeUse::create(Func, Dest)); | 2700 _mov_nonkillable(Dest, Zero); |
| 2705 _mov(Dest, Zero); | |
| 2706 Context.insert(Label); | 2701 Context.insert(Label); |
| 2707 } | 2702 } |
| 2708 | 2703 |
| 2709 void TargetX8632::lowerInsertElement(const InstInsertElement *Inst) { | 2704 void TargetX8632::lowerInsertElement(const InstInsertElement *Inst) { |
| 2710 Operand *SourceVectNotLegalized = Inst->getSrc(0); | 2705 Operand *SourceVectNotLegalized = Inst->getSrc(0); |
| 2711 Operand *ElementToInsertNotLegalized = Inst->getSrc(1); | 2706 Operand *ElementToInsertNotLegalized = Inst->getSrc(1); |
| 2712 ConstantInteger32 *ElementIndex = | 2707 ConstantInteger32 *ElementIndex = |
| 2713 llvm::dyn_cast<ConstantInteger32>(Inst->getSrc(2)); | 2708 llvm::dyn_cast<ConstantInteger32>(Inst->getSrc(2)); |
| 2714 // Only constant indices are allowed in PNaCl IR. | 2709 // Only constant indices are allowed in PNaCl IR. |
| 2715 assert(ElementIndex); | 2710 assert(ElementIndex); |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3126 return; | 3121 return; |
| 3127 } | 3122 } |
| 3128 case Intrinsics::Stacksave: { | 3123 case Intrinsics::Stacksave: { |
| 3129 Variable *esp = Func->getTarget()->getPhysicalRegister(RegX8632::Reg_esp); | 3124 Variable *esp = Func->getTarget()->getPhysicalRegister(RegX8632::Reg_esp); |
| 3130 Variable *Dest = Instr->getDest(); | 3125 Variable *Dest = Instr->getDest(); |
| 3131 _mov(Dest, esp); | 3126 _mov(Dest, esp); |
| 3132 return; | 3127 return; |
| 3133 } | 3128 } |
| 3134 case Intrinsics::Stackrestore: { | 3129 case Intrinsics::Stackrestore: { |
| 3135 Variable *esp = Func->getTarget()->getPhysicalRegister(RegX8632::Reg_esp); | 3130 Variable *esp = Func->getTarget()->getPhysicalRegister(RegX8632::Reg_esp); |
| 3136 _mov(esp, Instr->getArg(0)); | 3131 _mov_nonkillable(esp, Instr->getArg(0)); |
| 3137 return; | 3132 return; |
| 3138 } | 3133 } |
| 3139 case Intrinsics::Trap: | 3134 case Intrinsics::Trap: |
| 3140 _ud2(); | 3135 _ud2(); |
| 3141 return; | 3136 return; |
| 3142 case Intrinsics::UnknownIntrinsic: | 3137 case Intrinsics::UnknownIntrinsic: |
| 3143 Func->setError("Should not be lowering UnknownIntrinsic"); | 3138 Func->setError("Should not be lowering UnknownIntrinsic"); |
| 3144 return; | 3139 return; |
| 3145 } | 3140 } |
| 3146 return; | 3141 return; |
| (...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3935 | 3930 |
| 3936 if (Dest->getType() == IceType_i64) { | 3931 if (Dest->getType() == IceType_i64) { |
| 3937 Variable *DestLo = llvm::cast<Variable>(loOperand(Dest)); | 3932 Variable *DestLo = llvm::cast<Variable>(loOperand(Dest)); |
| 3938 Variable *DestHi = llvm::cast<Variable>(hiOperand(Dest)); | 3933 Variable *DestHi = llvm::cast<Variable>(hiOperand(Dest)); |
| 3939 Operand *SrcLoRI = legalize(loOperand(SrcT), Legal_Reg | Legal_Imm); | 3934 Operand *SrcLoRI = legalize(loOperand(SrcT), Legal_Reg | Legal_Imm); |
| 3940 Operand *SrcHiRI = legalize(hiOperand(SrcT), Legal_Reg | Legal_Imm); | 3935 Operand *SrcHiRI = legalize(hiOperand(SrcT), Legal_Reg | Legal_Imm); |
| 3941 _cmp(ConditionRM, Zero); | 3936 _cmp(ConditionRM, Zero); |
| 3942 _mov(DestLo, SrcLoRI); | 3937 _mov(DestLo, SrcLoRI); |
| 3943 _mov(DestHi, SrcHiRI); | 3938 _mov(DestHi, SrcHiRI); |
| 3944 _br(CondX86::Br_ne, Label); | 3939 _br(CondX86::Br_ne, Label); |
| 3945 Context.insert(InstFakeUse::create(Func, DestLo)); | |
| 3946 Context.insert(InstFakeUse::create(Func, DestHi)); | |
| 3947 Operand *SrcFLo = loOperand(SrcF); | 3940 Operand *SrcFLo = loOperand(SrcF); |
| 3948 Operand *SrcFHi = hiOperand(SrcF); | 3941 Operand *SrcFHi = hiOperand(SrcF); |
| 3949 SrcLoRI = legalize(SrcFLo, Legal_Reg | Legal_Imm); | 3942 SrcLoRI = legalize(SrcFLo, Legal_Reg | Legal_Imm); |
| 3950 SrcHiRI = legalize(SrcFHi, Legal_Reg | Legal_Imm); | 3943 SrcHiRI = legalize(SrcFHi, Legal_Reg | Legal_Imm); |
| 3951 _mov(DestLo, SrcLoRI); | 3944 _mov_nonkillable(DestLo, SrcLoRI); |
| 3952 _mov(DestHi, SrcHiRI); | 3945 _mov_nonkillable(DestHi, SrcHiRI); |
| 3953 } else { | 3946 } else { |
| 3954 _cmp(ConditionRM, Zero); | 3947 _cmp(ConditionRM, Zero); |
| 3955 SrcT = legalize(SrcT, Legal_Reg | Legal_Imm); | 3948 SrcT = legalize(SrcT, Legal_Reg | Legal_Imm); |
| 3956 _mov(Dest, SrcT); | 3949 _mov(Dest, SrcT); |
| 3957 _br(CondX86::Br_ne, Label); | 3950 _br(CondX86::Br_ne, Label); |
| 3958 Context.insert(InstFakeUse::create(Func, Dest)); | |
| 3959 SrcF = legalize(SrcF, Legal_Reg | Legal_Imm); | 3951 SrcF = legalize(SrcF, Legal_Reg | Legal_Imm); |
| 3960 _mov(Dest, SrcF); | 3952 _mov_nonkillable(Dest, SrcF); |
| 3961 } | 3953 } |
| 3962 | 3954 |
| 3963 Context.insert(Label); | 3955 Context.insert(Label); |
| 3964 } | 3956 } |
| 3965 | 3957 |
| 3966 void TargetX8632::lowerStore(const InstStore *Inst) { | 3958 void TargetX8632::lowerStore(const InstStore *Inst) { |
| 3967 Operand *Value = Inst->getData(); | 3959 Operand *Value = Inst->getData(); |
| 3968 Operand *Addr = Inst->getAddr(); | 3960 Operand *Addr = Inst->getAddr(); |
| 3969 OperandX8632Mem *NewAddr = FormMemoryOperand(Addr, Value->getType()); | 3961 OperandX8632Mem *NewAddr = FormMemoryOperand(Addr, Value->getType()); |
| 3970 Type Ty = NewAddr->getType(); | 3962 Type Ty = NewAddr->getType(); |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4291 assert(Type != IceType_i64); | 4283 assert(Type != IceType_i64); |
| 4292 Variable *Reg = Func->makeVariable(Type); | 4284 Variable *Reg = Func->makeVariable(Type); |
| 4293 if (RegNum == Variable::NoRegister) | 4285 if (RegNum == Variable::NoRegister) |
| 4294 Reg->setWeightInfinite(); | 4286 Reg->setWeightInfinite(); |
| 4295 else | 4287 else |
| 4296 Reg->setRegNum(RegNum); | 4288 Reg->setRegNum(RegNum); |
| 4297 return Reg; | 4289 return Reg; |
| 4298 } | 4290 } |
| 4299 | 4291 |
| 4300 void TargetX8632::postLower() { | 4292 void TargetX8632::postLower() { |
| 4301 if (Ctx->getOptLevel() != Opt_m1) | 4293 if (Ctx->getOptLevel() != Opt_m1) { |
| 4294 // Find non-SSA instructions where Dest==Src0, and set the | |
|
jvoung (off chromium)
2014/10/13 20:50:50
Add a note to clarify that this is for two-address
Jim Stichnoth
2014/10/13 23:15:22
Done.
| |
| 4295 // DestNonKillable flag to keep liveness analysis consistent. | |
| 4296 for (Inst *Inst : Context) { | |
| 4297 if (Inst->isDeleted()) | |
| 4298 continue; | |
| 4299 if (Variable *Dest = Inst->getDest()) { | |
| 4300 // TODO(stichnot): We may need to consider all source | |
| 4301 // operands, not just the first one, if using 3-address | |
| 4302 // instructions. | |
| 4303 if (Inst->getSrcSize() > 0 && Inst->getSrc(0) == Dest) | |
| 4304 Inst->setDestNonKillable(); | |
| 4305 } | |
| 4306 } | |
| 4302 return; | 4307 return; |
| 4303 TimerMarker T(TimerStack::TT_postLower, Func); | 4308 } |
|
jvoung (off chromium)
2014/10/13 20:50:50
Is this removal intentional? Otherwise, you could
Jim Stichnoth
2014/10/13 23:15:22
Removed the enum value.
I removed the TimerMarker
| |
| 4304 // TODO: Avoid recomputing WhiteList every instruction. | 4309 // TODO: Avoid recomputing WhiteList every instruction. |
| 4305 RegSetMask RegInclude = RegSet_All; | 4310 RegSetMask RegInclude = RegSet_All; |
| 4306 RegSetMask RegExclude = RegSet_StackPointer; | 4311 RegSetMask RegExclude = RegSet_StackPointer; |
| 4307 if (hasFramePointer()) | 4312 if (hasFramePointer()) |
| 4308 RegExclude |= RegSet_FramePointer; | 4313 RegExclude |= RegSet_FramePointer; |
| 4309 llvm::SmallBitVector WhiteList = getRegisterSet(RegInclude, RegExclude); | 4314 llvm::SmallBitVector WhiteList = getRegisterSet(RegInclude, RegExclude); |
| 4310 // Make one pass to black-list pre-colored registers. TODO: If | 4315 // Make one pass to black-list pre-colored registers. TODO: If |
| 4311 // there was some prior register allocation pass that made register | 4316 // there was some prior register allocation pass that made register |
| 4312 // assignments, those registers need to be black-listed here as | 4317 // assignments, those registers need to be black-listed here as |
| 4313 // well. | 4318 // well. |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4537 llvm::report_fatal_error(StrBuf.str()); | 4542 llvm::report_fatal_error(StrBuf.str()); |
| 4538 break; | 4543 break; |
| 4539 } | 4544 } |
| 4540 } | 4545 } |
| 4541 } | 4546 } |
| 4542 Str << "\t.size\t" << MangledName << ", " << Global.getNumBytes() << "\n"; | 4547 Str << "\t.size\t" << MangledName << ", " << Global.getNumBytes() << "\n"; |
| 4543 } | 4548 } |
| 4544 } | 4549 } |
| 4545 | 4550 |
| 4546 } // end of namespace Ice | 4551 } // end of namespace Ice |
| OLD | NEW |