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

Side by Side Diff: src/IceInstX8632.cpp

Issue 802183004: Subzero: Use CFG-local arena allocation for relevant containers. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Typo fix Created 6 years 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 | « src/IceInst.h ('k') | src/IceOperand.h » ('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/IceInstX8632.cpp - X86-32 instruction implementation ---===// 1 //===- subzero/src/IceInstX8632.cpp - X86-32 instruction implementation ---===//
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 InstX8632 and OperandX8632 classes, 10 // This file implements the InstX8632 and OperandX8632 classes,
(...skipping 2005 matching lines...) Expand 10 before | Expand all | Expand 10 after
2016 return; 2016 return;
2017 Ostream &Str = Func->getContext()->getStrEmit(); 2017 Ostream &Str = Func->getContext()->getStrEmit();
2018 assert(getSrcSize() == 1); 2018 assert(getSrcSize() == 1);
2019 assert(getDest()->hasReg()); 2019 assert(getDest()->hasReg());
2020 Str << "\tleal\t"; 2020 Str << "\tleal\t";
2021 Operand *Src0 = getSrc(0); 2021 Operand *Src0 = getSrc(0);
2022 if (const auto Src0Var = llvm::dyn_cast<Variable>(Src0)) { 2022 if (const auto Src0Var = llvm::dyn_cast<Variable>(Src0)) {
2023 Type Ty = Src0Var->getType(); 2023 Type Ty = Src0Var->getType();
2024 // lea on x86-32 doesn't accept mem128 operands, so cast VSrc0 to an 2024 // lea on x86-32 doesn't accept mem128 operands, so cast VSrc0 to an
2025 // acceptable type. 2025 // acceptable type.
2026 Src0Var->asType(isVectorType(Ty) ? IceType_i32 : Ty).emit(Func); 2026 Src0Var->asType(isVectorType(Ty) ? IceType_i32 : Ty)->emit(Func);
2027 } else { 2027 } else {
2028 Src0->emit(Func); 2028 Src0->emit(Func);
2029 } 2029 }
2030 Str << ", "; 2030 Str << ", ";
2031 getDest()->emit(Func); 2031 getDest()->emit(Func);
2032 } 2032 }
2033 2033
2034 template <> void InstX8632Mov::emit(const Cfg *Func) const { 2034 template <> void InstX8632Mov::emit(const Cfg *Func) const {
2035 if (!ALLOW_DUMP) 2035 if (!ALLOW_DUMP)
2036 return; 2036 return;
(...skipping 12 matching lines...) Expand all
2049 // safe, we instead widen the dest to match src. This works even 2049 // safe, we instead widen the dest to match src. This works even
2050 // for stack-allocated dest variables because typeWidthOnStack() 2050 // for stack-allocated dest variables because typeWidthOnStack()
2051 // pads to a 4-byte boundary even if only a lower portion is used. 2051 // pads to a 4-byte boundary even if only a lower portion is used.
2052 // TODO: This assert disallows usages such as copying a floating point 2052 // TODO: This assert disallows usages such as copying a floating point
2053 // value between a vector and a scalar (which movss is used for). 2053 // value between a vector and a scalar (which movss is used for).
2054 // Clean this up. 2054 // Clean this up.
2055 assert(Func->getTarget()->typeWidthInBytesOnStack(DestTy) == 2055 assert(Func->getTarget()->typeWidthInBytesOnStack(DestTy) ==
2056 Func->getTarget()->typeWidthInBytesOnStack(SrcTy)); 2056 Func->getTarget()->typeWidthInBytesOnStack(SrcTy));
2057 Src->emit(Func); 2057 Src->emit(Func);
2058 Str << ", "; 2058 Str << ", ";
2059 getDest()->asType(SrcTy).emit(Func); 2059 getDest()->asType(SrcTy)->emit(Func);
2060 } 2060 }
2061 2061
2062 template <> void InstX8632Mov::emitIAS(const Cfg *Func) const { 2062 template <> void InstX8632Mov::emitIAS(const Cfg *Func) const {
2063 assert(getSrcSize() == 1); 2063 assert(getSrcSize() == 1);
2064 const Variable *Dest = getDest(); 2064 const Variable *Dest = getDest();
2065 const Operand *Src = getSrc(0); 2065 const Operand *Src = getSrc(0);
2066 Type DestTy = Dest->getType(); 2066 Type DestTy = Dest->getType();
2067 Type SrcTy = Src->getType(); 2067 Type SrcTy = Src->getType();
2068 // Mov can be used for GPRs or XMM registers. Also, the type does not 2068 // Mov can be used for GPRs or XMM registers. Also, the type does not
2069 // necessarily match (Mov can be used for bitcasts). However, when 2069 // necessarily match (Mov can be used for bitcasts). However, when
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
2439 << TypeX8632Attributes[getSrc(0)->getType()].PackString << "\t"; 2439 << TypeX8632Attributes[getSrc(0)->getType()].PackString << "\t";
2440 getSrc(1)->emit(Func); 2440 getSrc(1)->emit(Func);
2441 Str << ", "; 2441 Str << ", ";
2442 getSrc(0)->emit(Func); 2442 getSrc(0)->emit(Func);
2443 Str << ", "; 2443 Str << ", ";
2444 Variable *Dest = getDest(); 2444 Variable *Dest = getDest();
2445 // pextrw must take a register dest. There is an SSE4.1 version that takes 2445 // pextrw must take a register dest. There is an SSE4.1 version that takes
2446 // a memory dest, but we aren't using it. For uniformity, just restrict 2446 // a memory dest, but we aren't using it. For uniformity, just restrict
2447 // them all to have a register dest for now. 2447 // them all to have a register dest for now.
2448 assert(Dest->hasReg()); 2448 assert(Dest->hasReg());
2449 Dest->asType(IceType_i32).emit(Func); 2449 Dest->asType(IceType_i32)->emit(Func);
2450 } 2450 }
2451 2451
2452 template <> void InstX8632Pextr::emitIAS(const Cfg *Func) const { 2452 template <> void InstX8632Pextr::emitIAS(const Cfg *Func) const {
2453 assert(getSrcSize() == 2); 2453 assert(getSrcSize() == 2);
2454 // pextrb and pextrd are SSE4.1 instructions. 2454 // pextrb and pextrd are SSE4.1 instructions.
2455 const Variable *Dest = getDest(); 2455 const Variable *Dest = getDest();
2456 Type DispatchTy = Dest->getType(); 2456 Type DispatchTy = Dest->getType();
2457 assert(DispatchTy == IceType_i16 || 2457 assert(DispatchTy == IceType_i16 ||
2458 static_cast<TargetX8632 *>(Func->getTarget())->getInstructionSet() >= 2458 static_cast<TargetX8632 *>(Func->getTarget())->getInstructionSet() >=
2459 TargetX8632::SSE4_1); 2459 TargetX8632::SSE4_1);
(...skipping 22 matching lines...) Expand all
2482 static_cast<TargetX8632 *>(Func->getTarget())->getInstructionSet() 2482 static_cast<TargetX8632 *>(Func->getTarget())->getInstructionSet()
2483 >= TargetX8632::SSE4_1); 2483 >= TargetX8632::SSE4_1);
2484 Str << "\t" << Opcode 2484 Str << "\t" << Opcode
2485 << TypeX8632Attributes[getDest()->getType()].PackString << "\t"; 2485 << TypeX8632Attributes[getDest()->getType()].PackString << "\t";
2486 getSrc(2)->emit(Func); 2486 getSrc(2)->emit(Func);
2487 Str << ", "; 2487 Str << ", ";
2488 Operand *Src1 = getSrc(1); 2488 Operand *Src1 = getSrc(1);
2489 if (const auto Src1Var = llvm::dyn_cast<Variable>(Src1)) { 2489 if (const auto Src1Var = llvm::dyn_cast<Variable>(Src1)) {
2490 // If src1 is a register, it should always be r32. 2490 // If src1 is a register, it should always be r32.
2491 if (Src1Var->hasReg()) { 2491 if (Src1Var->hasReg()) {
2492 Src1Var->asType(IceType_i32).emit(Func); 2492 Src1Var->asType(IceType_i32)->emit(Func);
2493 } else { 2493 } else {
2494 Src1Var->emit(Func); 2494 Src1Var->emit(Func);
2495 } 2495 }
2496 } else { 2496 } else {
2497 Src1->emit(Func); 2497 Src1->emit(Func);
2498 } 2498 }
2499 Str << ", "; 2499 Str << ", ";
2500 getDest()->emit(Func); 2500 getDest()->emit(Func);
2501 } 2501 }
2502 2502
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
2914 } 2914 }
2915 Str << "("; 2915 Str << "(";
2916 if (Func) 2916 if (Func)
2917 Var->dump(Func); 2917 Var->dump(Func);
2918 else 2918 else
2919 Var->dump(Str); 2919 Var->dump(Str);
2920 Str << ")"; 2920 Str << ")";
2921 } 2921 }
2922 2922
2923 } // end of namespace Ice 2923 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceInst.h ('k') | src/IceOperand.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698