[llvm-commits] CVS: poolalloc/lib/PoolAllocate/PointerCompress.cpp
Chris Lattner
lattner at cs.uiuc.edu
Thu Feb 10 13:54:00 PST 2005
Changes in directory poolalloc/lib/PoolAllocate:
PointerCompress.cpp updated: 1.5 -> 1.6
---
Log message:
Implement comparison of compressed pointers.
---
Diffs of the changes: (+22 -0)
Index: poolalloc/lib/PoolAllocate/PointerCompress.cpp
diff -u poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.5 poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.6
--- poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.5 Thu Feb 10 15:26:23 2005
+++ poolalloc/lib/PoolAllocate/PointerCompress.cpp Thu Feb 10 15:53:50 2005
@@ -297,6 +297,7 @@
void visitCastInst(CastInst &CI);
void visitPHINode(PHINode &PN);
+ void visitSetCondInst(SetCondInst &SCI);
void visitLoadInst(LoadInst &LI);
void visitStoreInst(StoreInst &SI);
@@ -364,6 +365,27 @@
setTransformedValue(PN, New);
}
+void InstructionRewriter::visitSetCondInst(SetCondInst &SCI) {
+ if (!isa<PointerType>(SCI.getOperand(0)->getType())) return;
+ Value *NonNullPtr = SCI.getOperand(0);
+ if (isa<ConstantPointerNull>(NonNullPtr)) {
+ NonNullPtr = SCI.getOperand(1);
+ if (isa<ConstantPointerNull>(NonNullPtr))
+ return; // setcc null, null
+ }
+
+ const CompressedPoolInfo *SrcPI = getPoolInfo(NonNullPtr);
+ if (SrcPI == 0) return; // comparing non-compressed pointers.
+
+ std::string Name = SCI.getName(); SCI.setName("");
+ Value *New = new SetCondInst(SCI.getOpcode(),
+ getTransformedValue(SCI.getOperand(0)),
+ getTransformedValue(SCI.getOperand(1)),
+ Name, &SCI);
+ SCI.replaceAllUsesWith(New);
+ SCI.eraseFromParent();
+}
+
void InstructionRewriter::visitLoadInst(LoadInst &LI) {
if (isa<ConstantPointerNull>(LI.getOperand(0))) return; // load null ??
More information about the llvm-commits
mailing list