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 1566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1577 _movp(Dest, RI); | 1577 _movp(Dest, RI); |
1578 else | 1578 else |
1579 _mov(Dest, RI); | 1579 _mov(Dest, RI); |
1580 } | 1580 } |
1581 } | 1581 } |
1582 | 1582 |
1583 void TargetX8632::lowerBr(const InstBr *Inst) { | 1583 void TargetX8632::lowerBr(const InstBr *Inst) { |
1584 if (Inst->isUnconditional()) { | 1584 if (Inst->isUnconditional()) { |
1585 _br(Inst->getTargetUnconditional()); | 1585 _br(Inst->getTargetUnconditional()); |
1586 } else { | 1586 } else { |
1587 Operand *Src0 = legalize(Inst->getCondition()); | 1587 Operand *Src0 = legalize(Inst->getCondition(), Legal_Reg | Legal_Mem); |
1588 Constant *Zero = Ctx->getConstantZero(IceType_i32); | 1588 Constant *Zero = Ctx->getConstantZero(IceType_i32); |
1589 _cmp(Src0, Zero); | 1589 _cmp(Src0, Zero); |
1590 _br(InstX8632Br::Br_ne, Inst->getTargetTrue(), Inst->getTargetFalse()); | 1590 _br(InstX8632Br::Br_ne, Inst->getTargetTrue(), Inst->getTargetFalse()); |
1591 } | 1591 } |
1592 } | 1592 } |
1593 | 1593 |
1594 void TargetX8632::lowerCall(const InstCall *Instr) { | 1594 void TargetX8632::lowerCall(const InstCall *Instr) { |
1595 // Classify each argument operand according to the location where the | 1595 // Classify each argument operand according to the location where the |
1596 // argument is passed. | 1596 // argument is passed. |
1597 OperandList XmmArgs; | 1597 OperandList XmmArgs; |
(...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2474 if (Var->hasReg()) | 2474 if (Var->hasReg()) |
2475 IsSrc1ImmOrReg = true; | 2475 IsSrc1ImmOrReg = true; |
2476 } | 2476 } |
2477 | 2477 |
2478 // Try to fuse a compare immediately followed by a conditional branch. This | 2478 // Try to fuse a compare immediately followed by a conditional branch. This |
2479 // is possible when the compare dest and the branch source operands are the | 2479 // is possible when the compare dest and the branch source operands are the |
2480 // same, and are their only uses. TODO: implement this optimization for i64. | 2480 // same, and are their only uses. TODO: implement this optimization for i64. |
2481 if (InstBr *NextBr = llvm::dyn_cast_or_null<InstBr>(Context.getNextInst())) { | 2481 if (InstBr *NextBr = llvm::dyn_cast_or_null<InstBr>(Context.getNextInst())) { |
2482 if (Src0->getType() != IceType_i64 && !NextBr->isUnconditional() && | 2482 if (Src0->getType() != IceType_i64 && !NextBr->isUnconditional() && |
2483 Dest == NextBr->getSrc(0) && NextBr->isLastUse(Dest)) { | 2483 Dest == NextBr->getSrc(0) && NextBr->isLastUse(Dest)) { |
2484 Operand *Src0New = | 2484 Operand *Src0New = legalize( |
2485 legalize(Src0, IsSrc1ImmOrReg ? Legal_All : Legal_Reg, true); | 2485 Src0, IsSrc1ImmOrReg ? (Legal_Reg | Legal_Mem) : Legal_Reg, true); |
2486 _cmp(Src0New, Src1); | 2486 _cmp(Src0New, Src1); |
2487 _br(getIcmp32Mapping(Inst->getCondition()), NextBr->getTargetTrue(), | 2487 _br(getIcmp32Mapping(Inst->getCondition()), NextBr->getTargetTrue(), |
2488 NextBr->getTargetFalse()); | 2488 NextBr->getTargetFalse()); |
2489 // Skip over the following branch instruction. | 2489 // Skip over the following branch instruction. |
2490 NextBr->setDeleted(); | 2490 NextBr->setDeleted(); |
2491 Context.advanceNext(); | 2491 Context.advanceNext(); |
2492 return; | 2492 return; |
2493 } | 2493 } |
2494 } | 2494 } |
2495 | 2495 |
(...skipping 1667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4163 for (SizeT i = 0; i < Size; ++i) { | 4163 for (SizeT i = 0; i < Size; ++i) { |
4164 Str << "\t.byte\t" << (((unsigned)Data[i]) & 0xff) << "\n"; | 4164 Str << "\t.byte\t" << (((unsigned)Data[i]) & 0xff) << "\n"; |
4165 } | 4165 } |
4166 Str << "\t.size\t" << MangledName << ", " << Size << "\n"; | 4166 Str << "\t.size\t" << MangledName << ", " << Size << "\n"; |
4167 } | 4167 } |
4168 Str << "\t" << (IsInternal ? ".local" : ".global") << "\t" << MangledName | 4168 Str << "\t" << (IsInternal ? ".local" : ".global") << "\t" << MangledName |
4169 << "\n"; | 4169 << "\n"; |
4170 } | 4170 } |
4171 | 4171 |
4172 } // end of namespace Ice | 4172 } // end of namespace Ice |
OLD | NEW |