Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(448)

Side by Side Diff: src/IceTargetLoweringX8632.cpp

Issue 563303003: Subzero: Always be sure x87 FP stack is emptied after a call. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | tests_lit/llvm2ice_tests/fpcall.ll » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1882 matching lines...) Expand 10 before | Expand all | Expand 10 after
1893 Dest->setPreferredRegister(ReturnReg, false); 1893 Dest->setPreferredRegister(ReturnReg, false);
1894 if (isVectorType(Dest->getType())) { 1894 if (isVectorType(Dest->getType())) {
1895 _movp(Dest, ReturnReg); 1895 _movp(Dest, ReturnReg);
1896 } else { 1896 } else {
1897 _mov(Dest, ReturnReg); 1897 _mov(Dest, ReturnReg);
1898 } 1898 }
1899 } 1899 }
1900 } else if (Dest->getType() == IceType_f32 || Dest->getType() == IceType_f64) { 1900 } else if (Dest->getType() == IceType_f32 || Dest->getType() == IceType_f64) {
1901 // Special treatment for an FP function which returns its result in 1901 // Special treatment for an FP function which returns its result in
1902 // st(0). 1902 // st(0).
1903 _fstp(Dest);
1904 // If Dest ends up being a physical xmm register, the fstp emit code 1903 // If Dest ends up being a physical xmm register, the fstp emit code
1905 // will route st(0) through a temporary stack slot. 1904 // will route st(0) through a temporary stack slot.
1905 _fstp(Dest);
1906 // Create a fake use of Dest in case it actually isn't used,
1907 // because st(0) still needs to be popped.
1908 Context.insert(InstFakeUse::create(Func, Dest));
1906 } 1909 }
1907 } 1910 }
1908 1911
1909 void TargetX8632::lowerCast(const InstCast *Inst) { 1912 void TargetX8632::lowerCast(const InstCast *Inst) {
1910 // a = cast(b) ==> t=cast(b); a=t; (link t->b, link a->t, no overlap) 1913 // a = cast(b) ==> t=cast(b); a=t; (link t->b, link a->t, no overlap)
1911 InstCast::OpKind CastKind = Inst->getCastKind(); 1914 InstCast::OpKind CastKind = Inst->getCastKind();
1912 Variable *Dest = Inst->getDest(); 1915 Variable *Dest = Inst->getDest();
1913 switch (CastKind) { 1916 switch (CastKind) {
1914 default: 1917 default:
1915 Func->setError("Cast type not supported"); 1918 Func->setError("Cast type not supported");
(...skipping 2544 matching lines...) Expand 10 before | Expand all | Expand 10 after
4460 Str << "\t.align\t" << Align << "\n"; 4463 Str << "\t.align\t" << Align << "\n";
4461 Str << MangledName << ":\n"; 4464 Str << MangledName << ":\n";
4462 for (SizeT i = 0; i < Size; ++i) { 4465 for (SizeT i = 0; i < Size; ++i) {
4463 Str << "\t.byte\t" << (((unsigned)Data[i]) & 0xff) << "\n"; 4466 Str << "\t.byte\t" << (((unsigned)Data[i]) & 0xff) << "\n";
4464 } 4467 }
4465 Str << "\t.size\t" << MangledName << ", " << Size << "\n"; 4468 Str << "\t.size\t" << MangledName << ", " << Size << "\n";
4466 } 4469 }
4467 } 4470 }
4468 4471
4469 } // end of namespace Ice 4472 } // end of namespace Ice
OLDNEW
« no previous file with comments | « no previous file | tests_lit/llvm2ice_tests/fpcall.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698