[llvm-commits] [llvm] r52988 - /llvm/trunk/lib/CodeGen/MachineInstr.cpp
Owen Anderson
resistor at mac.com
Tue Jul 1 15:31:32 PDT 2008
Is there any speedup associated with this?
--Owen
On Jul 1, 2008, at 3:21 PM, Evan Cheng wrote:
> Author: evancheng
> Date: Tue Jul 1 17:21:21 2008
> New Revision: 52988
>
> URL: http://llvm.org/viewvc/llvm-project?rev=52988&view=rev
> Log:
> Simplify addRegisterKilled and addRegisterDead.
>
> Modified:
> llvm/trunk/lib/CodeGen/MachineInstr.cpp
>
> Modified: llvm/trunk/lib/CodeGen/MachineInstr.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineInstr.cpp?rev=52988&r1=52987&r2=52988&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- llvm/trunk/lib/CodeGen/MachineInstr.cpp (original)
> +++ llvm/trunk/lib/CodeGen/MachineInstr.cpp Tue Jul 1 17:21:21 2008
> @@ -738,7 +738,7 @@
> const TargetRegisterInfo
> *RegInfo,
> bool AddIfNotFound) {
> bool isPhysReg =
> TargetRegisterInfo::isPhysicalRegister(IncomingReg);
> - bool Found = false;
> + bool hasAliases = isPhysReg && RegInfo->getAliasSet(IncomingReg);
> SmallVector<unsigned,4> DeadOps;
> for (unsigned i = 0, e = getNumOperands(); i != e; ++i) {
> MachineOperand &MO = getOperand(i);
> @@ -749,15 +749,15 @@
> continue;
>
> if (Reg == IncomingReg) {
> - if (!Found) // One kill of reg per instruction.
> - MO.setIsKill();
> - Found = true;
> - } else if (isPhysReg && MO.isKill() &&
> - TargetRegisterInfo::isPhysicalRegister(Reg)) {
> + MO.setIsKill();
> + return true;
> + }
> + if (hasAliases && MO.isKill() &&
> + TargetRegisterInfo::isPhysicalRegister(Reg)) {
> // A super-register kill already exists.
> if (RegInfo->isSuperRegister(IncomingReg, Reg))
> - Found = true;
> - else if (RegInfo->isSubRegister(IncomingReg, Reg))
> + return true;
> + if (RegInfo->isSubRegister(IncomingReg, Reg))
> DeadOps.push_back(i);
> }
> }
> @@ -774,14 +774,14 @@
>
> // If not found, this means an alias of one of the operands is
> killed. Add a
> // new implicit operand if required.
> - if (!Found && AddIfNotFound) {
> + if (AddIfNotFound) {
> addOperand(MachineOperand::CreateReg(IncomingReg,
> false /*IsDef*/,
> true /*IsImp*/,
> true /*IsKill*/));
> return true;
> }
> - return Found;
> + return false;
> }
>
> bool MachineInstr::addRegisterDead(unsigned IncomingReg,
> @@ -789,7 +789,6 @@
> bool AddIfNotFound) {
> bool isPhysReg =
> TargetRegisterInfo::isPhysicalRegister(IncomingReg);
> bool hasAliases = isPhysReg && RegInfo->getAliasSet(IncomingReg);
> - bool Found = false;
> SmallVector<unsigned,4> DeadOps;
> for (unsigned i = 0, e = getNumOperands(); i != e; ++i) {
> MachineOperand &MO = getOperand(i);
> @@ -798,13 +797,14 @@
> unsigned Reg = MO.getReg();
> if (Reg == IncomingReg) {
> MO.setIsDead();
> - Found = true;
> - } else if (hasAliases && MO.isDead() &&
> - TargetRegisterInfo::isPhysicalRegister(Reg)) {
> + return true;
> + }
> + if (hasAliases && MO.isDead() &&
> + TargetRegisterInfo::isPhysicalRegister(Reg)) {
> // There exists a super-register that's marked dead.
> if (RegInfo->isSuperRegister(IncomingReg, Reg))
> - Found = true;
> - else if (RegInfo->isSubRegister(IncomingReg, Reg))
> + return true;
> + if (RegInfo->isSubRegister(IncomingReg, Reg))
> DeadOps.push_back(i);
> }
> }
> @@ -821,13 +821,13 @@
>
> // If not found, this means an alias of one of the operand is
> dead. Add a
> // new implicit operand.
> - if (!Found && AddIfNotFound) {
> + if (AddIfNotFound) {
> addOperand(MachineOperand::CreateReg(IncomingReg, true/*IsDef*/,
> true/*IsImp*/,false/
> *IsKill*/,
> true/*IsDead*/));
> return true;
> }
> - return Found;
> + return false;
> }
>
> /// copyKillDeadInfo - copies killed/dead information from one instr
> to another
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list