diff options
| author | Evan Cheng <evan.cheng@apple.com> | 2008-07-03 09:09:37 +0000 |
|---|---|---|
| committer | Evan Cheng <evan.cheng@apple.com> | 2008-07-03 09:09:37 +0000 |
| commit | e52c191890057ab4cec065505b0b27f8586eb1b5 (patch) | |
| tree | c713798c01964fdb5e667374c5f276d9cec2795e /include/llvm | |
| parent | 43f0c65e2533adfe6d4b2c199919516dbd402552 (diff) | |
| download | external_llvm-e52c191890057ab4cec065505b0b27f8586eb1b5.zip external_llvm-e52c191890057ab4cec065505b0b27f8586eb1b5.tar.gz external_llvm-e52c191890057ab4cec065505b0b27f8586eb1b5.tar.bz2 | |
- Remove calls to copyKillDeadInfo which is an N^2 function. Instead, propagate kill / dead markers as new instructions are constructed in foldMemoryOperand, convertToThressAddress, etc.
- Also remove LiveVariables::instructionChanged, etc. Replace all calls with cheaper calls which update VarInfo kill list.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53097 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm')
| -rw-r--r-- | include/llvm/CodeGen/LiveVariables.h | 42 | ||||
| -rw-r--r-- | include/llvm/CodeGen/MachineInstr.h | 10 |
2 files changed, 14 insertions, 38 deletions
diff --git a/include/llvm/CodeGen/LiveVariables.h b/include/llvm/CodeGen/LiveVariables.h index bbefbe0..d02cfa6 100644 --- a/include/llvm/CodeGen/LiveVariables.h +++ b/include/llvm/CodeGen/LiveVariables.h @@ -52,8 +52,7 @@ public: /// non-phi instructions that are the last users of the value. /// /// In the common case where a value is defined and killed in the same block, - /// DefInst is the defining inst, there is one killing instruction, and - /// AliveBlocks is empty. + /// There is one killing instruction, and AliveBlocks is empty. /// /// Otherwise, the value is live out of the block. If the value is live /// across any blocks, these blocks are listed in AliveBlocks. Blocks where @@ -68,16 +67,11 @@ public: /// but does include the predecessor block in the AliveBlocks set (unless that /// block also defines the value). This leads to the (perfectly sensical) /// situation where a value is defined in a block, and the last use is a phi - /// node in the successor. In this case, DefInst will be the defining - /// instruction, AliveBlocks is empty (the value is not live across any - /// blocks) and Kills is empty (phi nodes are not included). This is sensical - /// because the value must be live to the end of the block, but is not live in - /// any successor blocks. + /// node in the successor. In this case, AliveBlocks is empty (the value is + /// not live across any blocks) and Kills is empty (phi nodes are not + /// included). This is sensical because the value must be live to the end of + /// the block, but is not live in any successor blocks. struct VarInfo { - /// DefInst - The machine instruction that defines this register. - /// - MachineInstr *DefInst; - /// AliveBlocks - Set of blocks of which this value is alive completely /// through. This is a bit set which uses the basic block number as an /// index. @@ -97,7 +91,7 @@ public: /// std::vector<MachineInstr*> Kills; - VarInfo() : DefInst(0), NumUses(0) {} + VarInfo() : NumUses(0) {} /// removeKill - Delete a kill corresponding to the specified /// machine instruction. Returns true if there was a kill @@ -183,12 +177,6 @@ public: //===--------------------------------------------------------------------===// // API to update live variable information - /// instructionChanged - When the address of an instruction changes, this - /// method should be called so that live variables can update its internal - /// data structures. This removes the records for OldMI, transfering them to - /// the records for NewMI. - void instructionChanged(MachineInstr *OldMI, MachineInstr *NewMI); - /// replaceKillInstruction - Update register kill info by replacing a kill /// instruction with a new one. void replaceKillInstruction(unsigned Reg, MachineInstr *OldMI, @@ -204,13 +192,11 @@ public: getVarInfo(IncomingReg).Kills.push_back(MI); } - /// removeVirtualRegisterKilled - Remove the specified virtual + /// removeVirtualRegisterKilled - Remove the specified kill of the virtual /// register from the live variable information. Returns true if the /// variable was marked as killed by the specified instruction, /// false otherwise. - bool removeVirtualRegisterKilled(unsigned reg, - MachineBasicBlock *MBB, - MachineInstr *MI) { + bool removeVirtualRegisterKilled(unsigned reg, MachineInstr *MI) { if (!getVarInfo(reg).removeKill(MI)) return false; @@ -238,16 +224,14 @@ public: void addVirtualRegisterDead(unsigned IncomingReg, MachineInstr *MI, bool AddIfNotFound = false) { if (MI->addRegisterDead(IncomingReg, TRI, AddIfNotFound)) - getVarInfo(IncomingReg).Kills.push_back(MI); + getVarInfo(IncomingReg).Kills.push_back(MI); } - /// removeVirtualRegisterDead - Remove the specified virtual + /// removeVirtualRegisterDead - Remove the specified kill of the virtual /// register from the live variable information. Returns true if the /// variable was marked dead at the specified instruction, false /// otherwise. - bool removeVirtualRegisterDead(unsigned reg, - MachineBasicBlock *MBB, - MachineInstr *MI) { + bool removeVirtualRegisterDead(unsigned reg, MachineInstr *MI) { if (!getVarInfo(reg).removeKill(MI)) return false; @@ -264,10 +248,6 @@ public: return true; } - /// removeVirtualRegistersDead - Remove all of the dead registers for the - /// specified instruction from the live variable information. - void removeVirtualRegistersDead(MachineInstr *MI); - virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesAll(); } diff --git a/include/llvm/CodeGen/MachineInstr.h b/include/llvm/CodeGen/MachineInstr.h index 5fc0624..06d15ab 100644 --- a/include/llvm/CodeGen/MachineInstr.h +++ b/include/llvm/CodeGen/MachineInstr.h @@ -234,13 +234,9 @@ public: bool addRegisterDead(unsigned IncomingReg, const TargetRegisterInfo *RegInfo, bool AddIfNotFound = false); - /// copyKillDeadInfo - Copies killed/dead information from one instr to another - void copyKillDeadInfo(MachineInstr *OldMI, - const TargetRegisterInfo *RegInfo); - - /// isSafeToMove - Return true if it is safe to this instruction. If SawStore - /// true, it means there is a store (or call) between the instruction the - /// localtion and its intended destination. + /// isSafeToMove - Return true if it is safe to move this instruction. If + /// SawStore is set to true, it means that there is a store (or call) between + /// the instruction's location and its intended destination. bool isSafeToMove(const TargetInstrInfo *TII, bool &SawStore); // |
