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

Side by Side Diff: src/IceInstARM32.cpp

Issue 1159013002: Subzero ARM: addProlog/addEpilogue -- share some code with x86. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: rename field Created 5 years, 6 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
OLDNEW
1 //===- subzero/src/IceInstARM32.cpp - ARM32 instruction implementation ----===// 1 //===- subzero/src/IceInstARM32.cpp - ARM32 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 InstARM32 and OperandARM32 classes, 10 // This file implements the InstARM32 and OperandARM32 classes,
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 253
254 InstARM32Mla::InstARM32Mla(Cfg *Func, Variable *Dest, Variable *Src0, 254 InstARM32Mla::InstARM32Mla(Cfg *Func, Variable *Dest, Variable *Src0,
255 Variable *Src1, Variable *Acc, 255 Variable *Src1, Variable *Acc,
256 CondARM32::Cond Predicate) 256 CondARM32::Cond Predicate)
257 : InstARM32Pred(Func, InstARM32::Mla, 3, Dest, Predicate) { 257 : InstARM32Pred(Func, InstARM32::Mla, 3, Dest, Predicate) {
258 addSource(Src0); 258 addSource(Src0);
259 addSource(Src1); 259 addSource(Src1);
260 addSource(Acc); 260 addSource(Acc);
261 } 261 }
262 262
263 InstARM32Pop::InstARM32Pop(Cfg *Func, const VarList &Dests)
264 : InstARM32(Func, InstARM32::Pop, 0, Dests[0]), Dests(Dests) {
265 // We only track the first Dest directly. Other Dests should be
Jim Stichnoth 2015/05/30 16:58:54 I think we should consider treating the Dests valu
jvoung (off chromium) 2015/06/01 18:00:23 Yeah that seems cleaner, and it's already storing
266 // modeled with a FakeDef.
267 // A pop instruction affects the stack pointer and so it should not
268 // be allowed to be automatically dead-code eliminated. (The
269 // corresponding push instruction doesn't need this treatment
270 // because it has no dest variable and therefore won't be dead-code
271 // eliminated.) This is needed for late-stage liveness analysis
272 // (e.g. asm-verbose mode).
273 HasSideEffects = true;
274 }
275
276 InstARM32Push::InstARM32Push(Cfg *Func, const VarList &Srcs)
277 : InstARM32(Func, InstARM32::Push, Srcs.size(), nullptr) {
278 for (Variable *Source : Srcs)
279 addSource(Source);
280 }
281
263 InstARM32Ret::InstARM32Ret(Cfg *Func, Variable *LR, Variable *Source) 282 InstARM32Ret::InstARM32Ret(Cfg *Func, Variable *LR, Variable *Source)
264 : InstARM32(Func, InstARM32::Ret, Source ? 2 : 1, nullptr) { 283 : InstARM32(Func, InstARM32::Ret, Source ? 2 : 1, nullptr) {
265 addSource(LR); 284 addSource(LR);
266 if (Source) 285 if (Source)
267 addSource(Source); 286 addSource(Source);
268 } 287 }
269 288
270 InstARM32Umull::InstARM32Umull(Cfg *Func, Variable *DestLo, Variable *DestHi, 289 InstARM32Umull::InstARM32Umull(Cfg *Func, Variable *DestLo, Variable *DestHi,
271 Variable *Src0, Variable *Src1, 290 Variable *Src0, Variable *Src1,
272 CondARM32::Cond Predicate) 291 CondARM32::Cond Predicate)
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 Dest->emit(Func); 566 Dest->emit(Func);
548 Str << ", "; 567 Str << ", ";
549 if (auto CR = llvm::dyn_cast<ConstantRelocatable>(Src1)) { 568 if (auto CR = llvm::dyn_cast<ConstantRelocatable>(Src1)) {
550 Str << "#:upper16:"; 569 Str << "#:upper16:";
551 CR->emitWithoutPrefix(Func->getTarget()); 570 CR->emitWithoutPrefix(Func->getTarget());
552 } else { 571 } else {
553 Src1->emit(Func); 572 Src1->emit(Func);
554 } 573 }
555 } 574 }
556 575
576 void InstARM32Pop::emit(const Cfg *Func) const {
577 if (!ALLOW_DUMP)
578 return;
579 assert(Dests.size() > 0);
580 Ostream &Str = Func->getContext()->getStrEmit();
581 Str << "\t"
582 << "pop"
583 << "\t{";
584 for (SizeT I = 0; I < Dests.size(); ++I) {
585 if (I > 0)
586 Str << ", ";
587 Dests[I]->emit(Func);
588 }
589 Str << "}";
590 }
591
592 void InstARM32Pop::emitIAS(const Cfg *Func) const {
593 (void)Func;
594 llvm_unreachable("Not yet implemented");
595 }
596
597 void InstARM32Pop::dump(const Cfg *Func) const {
598 if (!ALLOW_DUMP)
599 return;
600 Ostream &Str = Func->getContext()->getStrDump();
601 Str << "pop"
602 << " ";
603 for (SizeT I = 0; I < Dests.size(); ++I) {
604 if (I > 0)
605 Str << ", ";
606 Dests[I]->dump(Func);
607 }
608 }
609
610 void InstARM32Push::emit(const Cfg *Func) const {
611 if (!ALLOW_DUMP)
612 return;
613 assert(getSrcSize() > 0);
614 Ostream &Str = Func->getContext()->getStrEmit();
615 Str << "\t"
616 << "push"
617 << "\t{";
618 emitSources(Func);
619 Str << "}";
620 }
621
622 void InstARM32Push::emitIAS(const Cfg *Func) const {
623 (void)Func;
624 llvm_unreachable("Not yet implemented");
625 }
626
627 void InstARM32Push::dump(const Cfg *Func) const {
628 if (!ALLOW_DUMP)
629 return;
630 Ostream &Str = Func->getContext()->getStrDump();
631 Str << "push"
632 << " ";
633 dumpSources(Func);
634 }
635
557 void InstARM32Ret::emit(const Cfg *Func) const { 636 void InstARM32Ret::emit(const Cfg *Func) const {
558 if (!ALLOW_DUMP) 637 if (!ALLOW_DUMP)
559 return; 638 return;
560 assert(getSrcSize() > 0); 639 assert(getSrcSize() > 0);
561 Variable *LR = llvm::cast<Variable>(getSrc(0)); 640 Variable *LR = llvm::cast<Variable>(getSrc(0));
562 assert(LR->hasReg()); 641 assert(LR->hasReg());
563 assert(LR->getRegNum() == RegARM32::Reg_lr); 642 assert(LR->getRegNum() == RegARM32::Reg_lr);
564 Ostream &Str = Func->getContext()->getStrEmit(); 643 Ostream &Str = Func->getContext()->getStrEmit();
565 Str << "\t" 644 Str << "\t"
566 << "bx" 645 << "bx"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 getIndex()->dump(Func); 755 getIndex()->dump(Func);
677 else 756 else
678 getIndex()->dump(Str); 757 getIndex()->dump(Str);
679 if (getShiftOp() != kNoShift) { 758 if (getShiftOp() != kNoShift) {
680 Str << ", " << InstARM32ShiftAttributes[getShiftOp()].EmitString << " #" 759 Str << ", " << InstARM32ShiftAttributes[getShiftOp()].EmitString << " #"
681 << getShiftAmt(); 760 << getShiftAmt();
682 } 761 }
683 } else { 762 } else {
684 getOffset()->dump(Func, Str); 763 getOffset()->dump(Func, Str);
685 } 764 }
686 Str << "] AddrMode==" << getAddrMode() << "\n"; 765 Str << "] AddrMode==" << getAddrMode();
687 } 766 }
688 767
689 void OperandARM32FlexImm::emit(const Cfg *Func) const { 768 void OperandARM32FlexImm::emit(const Cfg *Func) const {
690 if (!ALLOW_DUMP) 769 if (!ALLOW_DUMP)
691 return; 770 return;
692 Ostream &Str = Func->getContext()->getStrEmit(); 771 Ostream &Str = Func->getContext()->getStrEmit();
693 uint32_t Imm = getImm(); 772 uint32_t Imm = getImm();
694 uint32_t RotateAmt = getRotateAmt(); 773 uint32_t RotateAmt = getRotateAmt();
695 Str << "#" << Utils::rotateRight32(Imm, 2 * RotateAmt); 774 Str << "#" << Utils::rotateRight32(Imm, 2 * RotateAmt);
696 } 775 }
(...skipping 28 matching lines...) Expand all
725 if (getShiftOp() != kNoShift) { 804 if (getShiftOp() != kNoShift) {
726 Str << ", " << InstARM32ShiftAttributes[getShiftOp()].EmitString << " "; 805 Str << ", " << InstARM32ShiftAttributes[getShiftOp()].EmitString << " ";
727 if (Func) 806 if (Func)
728 getShiftAmt()->dump(Func); 807 getShiftAmt()->dump(Func);
729 else 808 else
730 getShiftAmt()->dump(Str); 809 getShiftAmt()->dump(Str);
731 } 810 }
732 } 811 }
733 812
734 } // end of namespace Ice 813 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceInstARM32.h ('k') | src/IceInstARM32.def » ('j') | src/IceTargetLowering.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698