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

Side by Side Diff: src/IceTargetLoweringARM32.cpp

Issue 1253833002: Subzero: Cleanly implement register allocation after phi lowering. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Improve translation-time performance Created 5 years, 4 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/IceTargetLoweringARM32.h ('k') | src/IceTargetLoweringMIPS32.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/IceTargetLoweringARM32.cpp - ARM32 lowering ------------===// 1 //===- subzero/src/IceTargetLoweringARM32.cpp - ARM32 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 /// \file 10 /// \file
(...skipping 1452 matching lines...) Expand 10 before | Expand all | Expand 10 after
1463 Operand *Src0Lo = legalize(loOperand(Src0), Legal_Reg | Legal_Flex); 1463 Operand *Src0Lo = legalize(loOperand(Src0), Legal_Reg | Legal_Flex);
1464 Operand *Src0Hi = legalize(hiOperand(Src0), Legal_Reg | Legal_Flex); 1464 Operand *Src0Hi = legalize(hiOperand(Src0), Legal_Reg | Legal_Flex);
1465 Variable *DestLo = llvm::cast<Variable>(loOperand(Dest)); 1465 Variable *DestLo = llvm::cast<Variable>(loOperand(Dest));
1466 Variable *DestHi = llvm::cast<Variable>(hiOperand(Dest)); 1466 Variable *DestHi = llvm::cast<Variable>(hiOperand(Dest));
1467 Variable *T_Lo = nullptr, *T_Hi = nullptr; 1467 Variable *T_Lo = nullptr, *T_Hi = nullptr;
1468 _mov(T_Lo, Src0Lo); 1468 _mov(T_Lo, Src0Lo);
1469 _mov(DestLo, T_Lo); 1469 _mov(DestLo, T_Lo);
1470 _mov(T_Hi, Src0Hi); 1470 _mov(T_Hi, Src0Hi);
1471 _mov(DestHi, T_Hi); 1471 _mov(DestHi, T_Hi);
1472 } else { 1472 } else {
1473 Operand *SrcR; 1473 Operand *NewSrc;
1474 if (Dest->hasReg()) { 1474 if (Dest->hasReg()) {
1475 // If Dest already has a physical register, then legalize the 1475 // If Dest already has a physical register, then legalize the Src operand
1476 // Src operand into a Variable with the same register 1476 // into a Variable with the same register assignment. This especially
1477 // assignment. This is mostly a workaround for advanced phi 1477 // helps allow the use of Flex operands.
1478 // lowering's ad-hoc register allocation which assumes no 1478 NewSrc = legalize(Src0, Legal_Reg | Legal_Flex, Dest->getRegNum());
1479 // register allocation is needed when at least one of the
1480 // operands is non-memory.
1481 // TODO(jvoung): check this for ARM.
1482 SrcR = legalize(Src0, Legal_Reg, Dest->getRegNum());
1483 } else { 1479 } else {
1484 // Dest could be a stack operand. Since we could potentially need 1480 // Dest could be a stack operand. Since we could potentially need
1485 // to do a Store (and store can only have Register operands), 1481 // to do a Store (and store can only have Register operands),
1486 // legalize this to a register. 1482 // legalize this to a register.
1487 SrcR = legalize(Src0, Legal_Reg); 1483 NewSrc = legalize(Src0, Legal_Reg);
1488 } 1484 }
1489 if (isVectorType(Dest->getType())) { 1485 if (isVectorType(Dest->getType())) {
1490 UnimplementedError(Func->getContext()->getFlags()); 1486 UnimplementedError(Func->getContext()->getFlags());
1491 } else { 1487 } else {
1492 _mov(Dest, SrcR); 1488 _mov(Dest, NewSrc);
1493 } 1489 }
1494 } 1490 }
1495 } 1491 }
1496 1492
1497 void TargetARM32::lowerBr(const InstBr *Inst) { 1493 void TargetARM32::lowerBr(const InstBr *Inst) {
1498 if (Inst->isUnconditional()) { 1494 if (Inst->isUnconditional()) {
1499 _br(Inst->getTargetUnconditional()); 1495 _br(Inst->getTargetUnconditional());
1500 return; 1496 return;
1501 } 1497 }
1502 Operand *Cond = Inst->getCondition(); 1498 Operand *Cond = Inst->getCondition();
(...skipping 905 matching lines...) Expand 10 before | Expand all | Expand 10 after
2408 } 2404 }
2409 2405
2410 void TargetARM32::lowerUnreachable(const InstUnreachable * /*Inst*/) { 2406 void TargetARM32::lowerUnreachable(const InstUnreachable * /*Inst*/) {
2411 _trap(); 2407 _trap();
2412 } 2408 }
2413 2409
2414 void TargetARM32::prelowerPhis() { 2410 void TargetARM32::prelowerPhis() {
2415 PhiLowering::prelowerPhis32Bit<TargetARM32>(this, Context.getNode(), Func); 2411 PhiLowering::prelowerPhis32Bit<TargetARM32>(this, Context.getNode(), Func);
2416 } 2412 }
2417 2413
2418 // Lower the pre-ordered list of assignments into mov instructions.
2419 // Also has to do some ad-hoc register allocation as necessary.
2420 void TargetARM32::lowerPhiAssignments(CfgNode *Node,
2421 const AssignList &Assignments) {
2422 (void)Node;
2423 (void)Assignments;
2424 UnimplementedError(Func->getContext()->getFlags());
2425 }
2426
2427 Variable *TargetARM32::makeVectorOfZeros(Type Ty, int32_t RegNum) { 2414 Variable *TargetARM32::makeVectorOfZeros(Type Ty, int32_t RegNum) {
2428 Variable *Reg = makeReg(Ty, RegNum); 2415 Variable *Reg = makeReg(Ty, RegNum);
2429 UnimplementedError(Func->getContext()->getFlags()); 2416 UnimplementedError(Func->getContext()->getFlags());
2430 return Reg; 2417 return Reg;
2431 } 2418 }
2432 2419
2433 // Helper for legalize() to emit the right code to lower an operand to a 2420 // Helper for legalize() to emit the right code to lower an operand to a
2434 // register of the appropriate type. 2421 // register of the appropriate type.
2435 Variable *TargetARM32::copyToReg(Operand *Src, int32_t RegNum) { 2422 Variable *TargetARM32::copyToReg(Operand *Src, int32_t RegNum) {
2436 Type Ty = Src->getType(); 2423 Type Ty = Src->getType();
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
2764 << ".eabi_attribute 68, 1 @ Tag_Virtualization_use\n"; 2751 << ".eabi_attribute 68, 1 @ Tag_Virtualization_use\n";
2765 if (CPUFeatures.hasFeature(TargetARM32Features::HWDivArm)) { 2752 if (CPUFeatures.hasFeature(TargetARM32Features::HWDivArm)) {
2766 Str << ".eabi_attribute 44, 2 @ Tag_DIV_use\n"; 2753 Str << ".eabi_attribute 44, 2 @ Tag_DIV_use\n";
2767 } 2754 }
2768 // Technically R9 is used for TLS with Sandboxing, and we reserve it. 2755 // Technically R9 is used for TLS with Sandboxing, and we reserve it.
2769 // However, for compatibility with current NaCl LLVM, don't claim that. 2756 // However, for compatibility with current NaCl LLVM, don't claim that.
2770 Str << ".eabi_attribute 14, 3 @ Tag_ABI_PCS_R9_use: Not used\n"; 2757 Str << ".eabi_attribute 14, 3 @ Tag_ABI_PCS_R9_use: Not used\n";
2771 } 2758 }
2772 2759
2773 } // end of namespace Ice 2760 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceTargetLoweringARM32.h ('k') | src/IceTargetLoweringMIPS32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698