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

Side by Side Diff: src/IceInstMIPS32.cpp

Issue 2367743004: Subzero, MIPS32: Binding intrablock labels, unconditional branch (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 4 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 | « src/IceAssemblerMIPS32.h ('k') | no next file » | 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/IceInstMips32.cpp - Mips32 instruction implementation --===// 1 //===- subzero/src/IceInstMips32.cpp - Mips32 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 /// \file 10 /// \file
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 } 266 }
267 267
268 void InstMIPS32Label::emit(const Cfg *Func) const { 268 void InstMIPS32Label::emit(const Cfg *Func) const {
269 if (!BuildDefs::dump()) 269 if (!BuildDefs::dump())
270 return; 270 return;
271 Ostream &Str = Func->getContext()->getStrEmit(); 271 Ostream &Str = Func->getContext()->getStrEmit();
272 Str << getLabelName() << ":"; 272 Str << getLabelName() << ":";
273 } 273 }
274 274
275 void InstMIPS32Label::emitIAS(const Cfg *Func) const { 275 void InstMIPS32Label::emitIAS(const Cfg *Func) const {
276 (void)Func; 276 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>();
277 llvm_unreachable("Not yet implemented"); 277 Asm->bindLocalLabel(this, Number);
278 // if (Asm->needsTextFixup())
jaydeep.patil 2016/09/24 08:05:18 Commented code
obucinac 2016/09/26 17:16:25 Removed. Implementation will be added in a separa
279 // emitUsingTextFixup(Func);
278 } 280 }
279 281
280 InstMIPS32Call::InstMIPS32Call(Cfg *Func, Variable *Dest, Operand *CallTarget) 282 InstMIPS32Call::InstMIPS32Call(Cfg *Func, Variable *Dest, Operand *CallTarget)
281 : InstMIPS32(Func, InstMIPS32::Call, 1, Dest) { 283 : InstMIPS32(Func, InstMIPS32::Call, 1, Dest) {
282 HasSideEffects = true; 284 HasSideEffects = true;
283 addSource(CallTarget); 285 addSource(CallTarget);
284 } 286 }
285 287
286 InstMIPS32Mov::InstMIPS32Mov(Cfg *Func, Variable *Dest, Operand *Src) 288 InstMIPS32Mov::InstMIPS32Mov(Cfg *Func, Variable *Dest, Operand *Src)
287 : InstMIPS32(Func, InstMIPS32::Mov, 2, Dest) { 289 : InstMIPS32(Func, InstMIPS32::Mov, 2, Dest) {
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 assert(RA->getRegNum() == RegMIPS32::Reg_RA); 414 assert(RA->getRegNum() == RegMIPS32::Reg_RA);
413 Ostream &Str = Func->getContext()->getStrEmit(); 415 Ostream &Str = Func->getContext()->getStrEmit();
414 Str << "\t" 416 Str << "\t"
415 "jr" 417 "jr"
416 "\t"; 418 "\t";
417 RA->emit(Func); 419 RA->emit(Func);
418 } 420 }
419 421
420 void InstMIPS32Br::emitIAS(const Cfg *Func) const { 422 void InstMIPS32Br::emitIAS(const Cfg *Func) const {
421 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); 423 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>();
422 if (isUnconditionalBranch()) { 424 if (Label != nullptr) {
425 // Intra-block branches are of kind bcc
426 Asm->bcc(Predicate, getSrc(0), getSrc(1),
427 Asm->getOrCreateLocalLabel(Label->getNumber()));
428 } else if (isUnconditionalBranch()) {
423 Asm->b(Asm->getOrCreateCfgNodeLabel(getTargetFalse()->getIndex())); 429 Asm->b(Asm->getOrCreateCfgNodeLabel(getTargetFalse()->getIndex()));
424 } else { 430 } else {
425 switch (Predicate) { 431 switch (Predicate) {
426 default: 432 default:
427 break; 433 break;
428 case CondMIPS32::EQ: 434 case CondMIPS32::EQ:
429 case CondMIPS32::NE: 435 case CondMIPS32::NE:
430 Asm->bcc(Predicate, getSrc(0), getSrc(1), 436 Asm->bcc(Predicate, getSrc(0), getSrc(1),
431 Asm->getOrCreateCfgNodeLabel(getTargetFalse()->getIndex())); 437 Asm->getOrCreateCfgNodeLabel(getTargetFalse()->getIndex()));
432 break; 438 break;
433 case CondMIPS32::EQZ: 439 case CondMIPS32::EQZ:
434 case CondMIPS32::NEZ: 440 case CondMIPS32::NEZ:
435 case CondMIPS32::LEZ: 441 case CondMIPS32::LEZ:
436 case CondMIPS32::LTZ: 442 case CondMIPS32::LTZ:
437 case CondMIPS32::GEZ: 443 case CondMIPS32::GEZ:
438 case CondMIPS32::GTZ: 444 case CondMIPS32::GTZ:
439 Asm->bzc(Predicate, getSrc(0), 445 Asm->bzc(Predicate, getSrc(0),
440 Asm->getOrCreateCfgNodeLabel(getTargetFalse()->getIndex())); 446 Asm->getOrCreateCfgNodeLabel(getTargetFalse()->getIndex()));
441 break; 447 break;
442 } 448 }
449 if (getTargetTrue()) {
450 Asm->b(Asm->getOrCreateCfgNodeLabel(getTargetTrue()->getIndex()));
451 }
443 } 452 }
444 } 453 }
445 454
446 void InstMIPS32Br::emit(const Cfg *Func) const { 455 void InstMIPS32Br::emit(const Cfg *Func) const {
447 if (!BuildDefs::dump()) 456 if (!BuildDefs::dump())
448 return; 457 return;
449 Ostream &Str = Func->getContext()->getStrEmit(); 458 Ostream &Str = Func->getContext()->getStrEmit();
450 Str << "\t" 459 Str << "\t"
451 "b" << InstMIPS32CondAttributes[Predicate].EmitString << "\t"; 460 "b" << InstMIPS32CondAttributes[Predicate].EmitString << "\t";
452 if (Label != nullptr) { 461 if (Label != nullptr) {
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after
1122 Asm->xor_(getDest(), getSrc(0), getSrc(1)); 1131 Asm->xor_(getDest(), getSrc(0), getSrc(1));
1123 } 1132 }
1124 1133
1125 template <> void InstMIPS32Xori::emitIAS(const Cfg *Func) const { 1134 template <> void InstMIPS32Xori::emitIAS(const Cfg *Func) const {
1126 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); 1135 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>();
1127 Asm->xori(getDest(), getSrc(0), Imm); 1136 Asm->xori(getDest(), getSrc(0), Imm);
1128 } 1137 }
1129 1138
1130 } // end of namespace MIPS32 1139 } // end of namespace MIPS32
1131 } // end of namespace Ice 1140 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceAssemblerMIPS32.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698