OLD | NEW |
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 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 : InstX8632(Func, InstX8632::Push, 1, nullptr) { | 332 : InstX8632(Func, InstX8632::Push, 1, nullptr) { |
333 addSource(Source); | 333 addSource(Source); |
334 } | 334 } |
335 | 335 |
336 InstX8632Ret::InstX8632Ret(Cfg *Func, Variable *Source) | 336 InstX8632Ret::InstX8632Ret(Cfg *Func, Variable *Source) |
337 : InstX8632(Func, InstX8632::Ret, Source ? 1 : 0, nullptr) { | 337 : InstX8632(Func, InstX8632::Ret, Source ? 1 : 0, nullptr) { |
338 if (Source) | 338 if (Source) |
339 addSource(Source); | 339 addSource(Source); |
340 } | 340 } |
341 | 341 |
| 342 InstX8632Setcc::InstX8632Setcc(Cfg *Func, Variable *Dest, CondX86::BrCond Cond) |
| 343 : InstX8632(Func, InstX8632::Setcc, 0, Dest), Condition(Cond) {} |
| 344 |
342 InstX8632Xadd::InstX8632Xadd(Cfg *Func, Operand *Dest, Variable *Source, | 345 InstX8632Xadd::InstX8632Xadd(Cfg *Func, Operand *Dest, Variable *Source, |
343 bool Locked) | 346 bool Locked) |
344 : InstX8632Lockable(Func, InstX8632::Xadd, 2, | 347 : InstX8632Lockable(Func, InstX8632::Xadd, 2, |
345 llvm::dyn_cast<Variable>(Dest), Locked) { | 348 llvm::dyn_cast<Variable>(Dest), Locked) { |
346 addSource(Dest); | 349 addSource(Dest); |
347 addSource(Source); | 350 addSource(Source); |
348 } | 351 } |
349 | 352 |
350 InstX8632Xchg::InstX8632Xchg(Cfg *Func, Operand *Dest, Variable *Source) | 353 InstX8632Xchg::InstX8632Xchg(Cfg *Func, Operand *Dest, Variable *Source) |
351 : InstX8632(Func, InstX8632::Xchg, 2, llvm::dyn_cast<Variable>(Dest)) { | 354 : InstX8632(Func, InstX8632::Xchg, 2, llvm::dyn_cast<Variable>(Dest)) { |
(...skipping 2367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2719 | 2722 |
2720 void InstX8632Ret::dump(const Cfg *Func) const { | 2723 void InstX8632Ret::dump(const Cfg *Func) const { |
2721 if (!ALLOW_DUMP) | 2724 if (!ALLOW_DUMP) |
2722 return; | 2725 return; |
2723 Ostream &Str = Func->getContext()->getStrDump(); | 2726 Ostream &Str = Func->getContext()->getStrDump(); |
2724 Type Ty = (getSrcSize() == 0 ? IceType_void : getSrc(0)->getType()); | 2727 Type Ty = (getSrcSize() == 0 ? IceType_void : getSrc(0)->getType()); |
2725 Str << "ret." << Ty << " "; | 2728 Str << "ret." << Ty << " "; |
2726 dumpSources(Func); | 2729 dumpSources(Func); |
2727 } | 2730 } |
2728 | 2731 |
| 2732 void InstX8632Setcc::emit(const Cfg *Func) const { |
| 2733 if (!ALLOW_DUMP) |
| 2734 return; |
| 2735 Ostream &Str = Func->getContext()->getStrEmit(); |
| 2736 Str << "\tset" << InstX8632BrAttributes[Condition].DisplayString << "\t"; |
| 2737 Dest->emit(Func); |
| 2738 } |
| 2739 |
| 2740 void InstX8632Setcc::emitIAS(const Cfg *Func) const { |
| 2741 assert(Condition != CondX86::Br_None); |
| 2742 assert(getDest()->getType() == IceType_i1); |
| 2743 assert(getSrcSize() == 0); |
| 2744 X8632::AssemblerX8632 *Asm = Func->getAssembler<X8632::AssemblerX8632>(); |
| 2745 if (getDest()->hasReg()) |
| 2746 Asm->setcc(Condition, RegX8632::getEncodedByteReg(getDest()->getRegNum())); |
| 2747 else |
| 2748 Asm->setcc(Condition, static_cast<TargetX8632 *>(Func->getTarget()) |
| 2749 ->stackVarToAsmOperand(getDest())); |
| 2750 return; |
| 2751 } |
| 2752 |
| 2753 void InstX8632Setcc::dump(const Cfg *Func) const { |
| 2754 if (!ALLOW_DUMP) |
| 2755 return; |
| 2756 Ostream &Str = Func->getContext()->getStrDump(); |
| 2757 Str << "setcc." << InstX8632BrAttributes[Condition].DisplayString << " "; |
| 2758 dumpDest(Func); |
| 2759 } |
| 2760 |
2729 void InstX8632Xadd::emit(const Cfg *Func) const { | 2761 void InstX8632Xadd::emit(const Cfg *Func) const { |
2730 if (!ALLOW_DUMP) | 2762 if (!ALLOW_DUMP) |
2731 return; | 2763 return; |
2732 Ostream &Str = Func->getContext()->getStrEmit(); | 2764 Ostream &Str = Func->getContext()->getStrEmit(); |
2733 if (Locked) { | 2765 if (Locked) { |
2734 Str << "\tlock"; | 2766 Str << "\tlock"; |
2735 } | 2767 } |
2736 Str << "\txadd" << getWidthString(getSrc(0)->getType()) << "\t"; | 2768 Str << "\txadd" << getWidthString(getSrc(0)->getType()) << "\t"; |
2737 getSrc(1)->emit(Func); | 2769 getSrc(1)->emit(Func); |
2738 Str << ", "; | 2770 Str << ", "; |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2963 } | 2995 } |
2964 Str << "("; | 2996 Str << "("; |
2965 if (Func) | 2997 if (Func) |
2966 Var->dump(Func); | 2998 Var->dump(Func); |
2967 else | 2999 else |
2968 Var->dump(Str); | 3000 Var->dump(Str); |
2969 Str << ")"; | 3001 Str << ")"; |
2970 } | 3002 } |
2971 | 3003 |
2972 } // end of namespace Ice | 3004 } // end of namespace Ice |
OLD | NEW |