mirror of
https://github.com/RPCSX/llvm.git
synced 2024-12-01 15:40:46 +00:00
Remove redundant comment. Use a more efficient datatype.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150780 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
1bc147b892
commit
3106b8b18b
@ -6,21 +6,12 @@
|
|||||||
// License. See LICENSE.TXT for details.
|
// License. See LICENSE.TXT for details.
|
||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
//
|
|
||||||
// This file provide the function DemoteRegToStack(). This function takes a
|
|
||||||
// virtual register computed by an Instruction and replaces it with a slot in
|
|
||||||
// the stack frame, allocated via alloca. It returns the pointer to the
|
|
||||||
// AllocaInst inserted. After this function is called on an instruction, we are
|
|
||||||
// guaranteed that the only user of the instruction is a store that is
|
|
||||||
// immediately after it.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
#include "llvm/Transforms/Utils/Local.h"
|
#include "llvm/Transforms/Utils/Local.h"
|
||||||
#include "llvm/Function.h"
|
#include "llvm/Function.h"
|
||||||
#include "llvm/Instructions.h"
|
#include "llvm/Instructions.h"
|
||||||
#include "llvm/Type.h"
|
#include "llvm/Type.h"
|
||||||
#include <map>
|
#include "llvm/ADT/DenseMap.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
/// DemoteRegToStack - This function takes a virtual register computed by an
|
/// DemoteRegToStack - This function takes a virtual register computed by an
|
||||||
@ -28,7 +19,7 @@ using namespace llvm;
|
|||||||
/// alloca. This allows the CFG to be changed around without fear of
|
/// alloca. This allows the CFG to be changed around without fear of
|
||||||
/// invalidating the SSA information for the value. It returns the pointer to
|
/// invalidating the SSA information for the value. It returns the pointer to
|
||||||
/// the alloca inserted to create a stack slot for I.
|
/// the alloca inserted to create a stack slot for I.
|
||||||
AllocaInst* llvm::DemoteRegToStack(Instruction &I, bool VolatileLoads,
|
AllocaInst *llvm::DemoteRegToStack(Instruction &I, bool VolatileLoads,
|
||||||
Instruction *AllocaPoint) {
|
Instruction *AllocaPoint) {
|
||||||
if (I.use_empty()) {
|
if (I.use_empty()) {
|
||||||
I.eraseFromParent();
|
I.eraseFromParent();
|
||||||
@ -59,7 +50,7 @@ AllocaInst* llvm::DemoteRegToStack(Instruction &I, bool VolatileLoads,
|
|||||||
// resulting PHI node will have multiple values (from each load) coming in
|
// resulting PHI node will have multiple values (from each load) coming in
|
||||||
// from the same block, which is illegal SSA form. For this reason, we
|
// from the same block, which is illegal SSA form. For this reason, we
|
||||||
// keep track of and reuse loads we insert.
|
// keep track of and reuse loads we insert.
|
||||||
std::map<BasicBlock*, Value*> Loads;
|
DenseMap<BasicBlock*, Value*> Loads;
|
||||||
for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i)
|
for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i)
|
||||||
if (PN->getIncomingValue(i) == &I) {
|
if (PN->getIncomingValue(i) == &I) {
|
||||||
Value *&V = Loads[PN->getIncomingBlock(i)];
|
Value *&V = Loads[PN->getIncomingBlock(i)];
|
||||||
@ -105,7 +96,7 @@ AllocaInst* llvm::DemoteRegToStack(Instruction &I, bool VolatileLoads,
|
|||||||
/// DemotePHIToStack - This function takes a virtual register computed by a PHI
|
/// DemotePHIToStack - This function takes a virtual register computed by a PHI
|
||||||
/// node and replaces it with a slot in the stack frame allocated via alloca.
|
/// node and replaces it with a slot in the stack frame allocated via alloca.
|
||||||
/// The PHI node is deleted. It returns the pointer to the alloca inserted.
|
/// The PHI node is deleted. It returns the pointer to the alloca inserted.
|
||||||
AllocaInst* llvm::DemotePHIToStack(PHINode *P, Instruction *AllocaPoint) {
|
AllocaInst *llvm::DemotePHIToStack(PHINode *P, Instruction *AllocaPoint) {
|
||||||
if (P->use_empty()) {
|
if (P->use_empty()) {
|
||||||
P->eraseFromParent();
|
P->eraseFromParent();
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user