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

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: Cleanup Created 5 years, 5 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/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 1454 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 *SrcR;
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
1479 // register allocation is needed when at least one of the
1480 // operands is non-memory.
1481 // TODO(jvoung): check this for ARM. 1478 // TODO(jvoung): check this for ARM.
jvoung (off chromium) 2015/07/24 19:43:08 can we remove the TODO now? I think it was about
Jim Stichnoth 2015/07/26 04:47:50 OK, done. I wasn't sure whether the todo referred
1482 SrcR = legalize(Src0, Legal_Reg, Dest->getRegNum()); 1479 SrcR = legalize(Src0, Legal_Reg | Legal_Flex, Dest->getRegNum());
1483 } else { 1480 } else {
1484 // Dest could be a stack operand. Since we could potentially need 1481 // Dest could be a stack operand. Since we could potentially need
1485 // to do a Store (and store can only have Register operands), 1482 // to do a Store (and store can only have Register operands),
1486 // legalize this to a register. 1483 // legalize this to a register.
1487 SrcR = legalize(Src0, Legal_Reg); 1484 SrcR = legalize(Src0, Legal_Reg);
1488 } 1485 }
1489 if (isVectorType(Dest->getType())) { 1486 if (isVectorType(Dest->getType())) {
1490 UnimplementedError(Func->getContext()->getFlags()); 1487 UnimplementedError(Func->getContext()->getFlags());
1491 } else { 1488 } else {
1492 _mov(Dest, SrcR); 1489 _mov(Dest, SrcR);
(...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after
2408 } 2405 }
2409 2406
2410 void TargetARM32::lowerUnreachable(const InstUnreachable * /*Inst*/) { 2407 void TargetARM32::lowerUnreachable(const InstUnreachable * /*Inst*/) {
2411 _trap(); 2408 _trap();
2412 } 2409 }
2413 2410
2414 void TargetARM32::prelowerPhis() { 2411 void TargetARM32::prelowerPhis() {
2415 PhiLowering::prelowerPhis32Bit<TargetARM32>(this, Context.getNode(), Func); 2412 PhiLowering::prelowerPhis32Bit<TargetARM32>(this, Context.getNode(), Func);
2416 } 2413 }
2417 2414
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) { 2415 Variable *TargetARM32::makeVectorOfZeros(Type Ty, int32_t RegNum) {
2428 Variable *Reg = makeReg(Ty, RegNum); 2416 Variable *Reg = makeReg(Ty, RegNum);
2429 UnimplementedError(Func->getContext()->getFlags()); 2417 UnimplementedError(Func->getContext()->getFlags());
2430 return Reg; 2418 return Reg;
2431 } 2419 }
2432 2420
2433 // Helper for legalize() to emit the right code to lower an operand to a 2421 // Helper for legalize() to emit the right code to lower an operand to a
2434 // register of the appropriate type. 2422 // register of the appropriate type.
2435 Variable *TargetARM32::copyToReg(Operand *Src, int32_t RegNum) { 2423 Variable *TargetARM32::copyToReg(Operand *Src, int32_t RegNum) {
2436 Type Ty = Src->getType(); 2424 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"; 2752 << ".eabi_attribute 68, 1 @ Tag_Virtualization_use\n";
2765 if (CPUFeatures.hasFeature(TargetARM32Features::HWDivArm)) { 2753 if (CPUFeatures.hasFeature(TargetARM32Features::HWDivArm)) {
2766 Str << ".eabi_attribute 44, 2 @ Tag_DIV_use\n"; 2754 Str << ".eabi_attribute 44, 2 @ Tag_DIV_use\n";
2767 } 2755 }
2768 // Technically R9 is used for TLS with Sandboxing, and we reserve it. 2756 // Technically R9 is used for TLS with Sandboxing, and we reserve it.
2769 // However, for compatibility with current NaCl LLVM, don't claim that. 2757 // 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"; 2758 Str << ".eabi_attribute 14, 3 @ Tag_ABI_PCS_R9_use: Not used\n";
2771 } 2759 }
2772 2760
2773 } // end of namespace Ice 2761 } // end of namespace Ice
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698