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 1746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1757 legalize(Src0, IsSrc1ImmOrReg ? Legal_All : Legal_Reg, true); | 1757 legalize(Src0, IsSrc1ImmOrReg ? Legal_All : Legal_Reg, true); |
1758 InstX8632Label *Label = InstX8632Label::create(Func, this); | 1758 InstX8632Label *Label = InstX8632Label::create(Func, this); |
1759 _cmp(Src0New, Src1); | 1759 _cmp(Src0New, Src1); |
1760 _mov(Dest, One); | 1760 _mov(Dest, One); |
1761 _br(getIcmp32Mapping(Inst->getCondition()), Label); | 1761 _br(getIcmp32Mapping(Inst->getCondition()), Label); |
1762 Context.insert(InstFakeUse::create(Func, Dest)); | 1762 Context.insert(InstFakeUse::create(Func, Dest)); |
1763 _mov(Dest, Zero); | 1763 _mov(Dest, Zero); |
1764 Context.insert(Label); | 1764 Context.insert(Label); |
1765 } | 1765 } |
1766 | 1766 |
1767 void TargetX8632::lowerIntrinsicCall(const InstIntrinsicCall *Instr) { | |
1768 switch (Instr->getIntrinsicInfo().ID) { | |
1769 case AtomicCmpxchg: | |
1770 case AtomicFence: | |
1771 case AtomicFenceAll: | |
1772 case AtomicIsLockFree: | |
1773 case AtomicLoad: | |
1774 case AtomicRMW: | |
1775 case AtomicStore: | |
1776 case Bswap: | |
1777 case Ctlz: | |
1778 case Ctpop: | |
1779 case Cttz: | |
1780 Func->setError("Unhandled intrinsic"); | |
1781 return; | |
1782 case Longjmp: { | |
1783 InstCall *Call = makeHelperCall("longjmp", NULL, 2); | |
1784 Call->addArg(Instr->getSrc(1)); | |
Jim Stichnoth
2014/06/10 22:58:28
Change all the Instr->getSrc(N) calls to Instr->ge
jvoung (off chromium)
2014/06/12 05:48:30
Done.
Also adding a crosstest runnable test. Curr
| |
1785 Call->addArg(Instr->getSrc(2)); | |
1786 lowerCall(Call); | |
1787 break; | |
1788 } | |
1789 case Memcpy: { | |
1790 // In the future, we could potentially emit an inline memcpy/memset, etc. | |
1791 // for intrinsic calls w/ a known length. | |
1792 InstCall *Call = makeHelperCall("memcpy", NULL, 3); | |
1793 Call->addArg(Instr->getSrc(1)); | |
1794 Call->addArg(Instr->getSrc(2)); | |
1795 Call->addArg(Instr->getSrc(3)); | |
1796 lowerCall(Call); | |
1797 break; | |
1798 } | |
1799 case Memmove: { | |
1800 InstCall *Call = makeHelperCall("memmove", NULL, 3); | |
1801 Call->addArg(Instr->getSrc(1)); | |
1802 Call->addArg(Instr->getSrc(2)); | |
1803 Call->addArg(Instr->getSrc(3)); | |
1804 lowerCall(Call); | |
1805 break; | |
1806 } | |
1807 case Memset: { | |
1808 InstCall *Call = makeHelperCall("memset", NULL, 3); | |
1809 Call->addArg(Instr->getSrc(1)); | |
1810 Call->addArg(Instr->getSrc(2)); | |
1811 Call->addArg(Instr->getSrc(3)); | |
1812 lowerCall(Call); | |
1813 break; | |
1814 } | |
1815 case NaClReadTP: { | |
1816 Constant *Zero = Ctx->getConstantInt(IceType_i32, 0); | |
1817 Operand *Src = OperandX8632MemOffSeg::create(Func, IceType_i32, | |
1818 Zero, Reg_GS); | |
1819 Variable *Dest = Instr->getDest(); | |
1820 // Src is already a memory operand, so we need Dest to be a register. | |
1821 Dest->setWeightInfinite(); | |
Jim Stichnoth
2014/06/10 22:58:28
This will force Dest to have a register for the en
jvoung (off chromium)
2014/06/12 05:48:30
Oops yeah otherwise it could potentially have a pr
| |
1822 _mov(Dest, Src); | |
1823 break; | |
1824 } | |
1825 case Setjmp: { | |
1826 InstCall *Call = makeHelperCall("setjmp", Instr->getDest(), 1); | |
1827 Call->addArg(Instr->getSrc(1)); | |
1828 lowerCall(Call); | |
1829 break; | |
1830 } | |
1831 case Sqrt: | |
1832 case Stacksave: | |
1833 case Stackrestore: | |
1834 Func->setError("Unhandled intrinsic"); | |
1835 return; | |
1836 case Trap: | |
1837 _ud2(); | |
1838 break; | |
1839 } | |
1840 return; | |
1841 } | |
1842 | |
1767 namespace { | 1843 namespace { |
1768 | 1844 |
1769 bool isAdd(const Inst *Inst) { | 1845 bool isAdd(const Inst *Inst) { |
1770 if (const InstArithmetic *Arith = | 1846 if (const InstArithmetic *Arith = |
1771 llvm::dyn_cast_or_null<const InstArithmetic>(Inst)) { | 1847 llvm::dyn_cast_or_null<const InstArithmetic>(Inst)) { |
1772 return (Arith->getOp() == InstArithmetic::Add); | 1848 return (Arith->getOp() == InstArithmetic::Add); |
1773 } | 1849 } |
1774 return false; | 1850 return false; |
1775 } | 1851 } |
1776 | 1852 |
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2259 // llvm-mc doesn't parse "dword ptr [.L$foo]". | 2335 // llvm-mc doesn't parse "dword ptr [.L$foo]". |
2260 Str << "dword ptr [L$" << IceType_f32 << "$" << getPoolEntryID() << "]"; | 2336 Str << "dword ptr [L$" << IceType_f32 << "$" << getPoolEntryID() << "]"; |
2261 } | 2337 } |
2262 | 2338 |
2263 template <> void ConstantDouble::emit(GlobalContext *Ctx) const { | 2339 template <> void ConstantDouble::emit(GlobalContext *Ctx) const { |
2264 Ostream &Str = Ctx->getStrEmit(); | 2340 Ostream &Str = Ctx->getStrEmit(); |
2265 Str << "qword ptr [L$" << IceType_f64 << "$" << getPoolEntryID() << "]"; | 2341 Str << "qword ptr [L$" << IceType_f64 << "$" << getPoolEntryID() << "]"; |
2266 } | 2342 } |
2267 | 2343 |
2268 } // end of namespace Ice | 2344 } // end of namespace Ice |
OLD | NEW |