allow demotion to volatile values
[oota-llvm.git] / include / llvm / Transforms / Utils / Local.h
index eb219456700f7260678fae52c03b490b8965bef8..25183154272cfdafa82a76b8cf376b4f212c7773 100644 (file)
@@ -1,10 +1,10 @@
 //===-- Local.h - Functions to perform local transformations ----*- C++ -*-===//
-// 
+//
 //                     The LLVM Compiler Infrastructure
 //
 // This file was developed by the LLVM research group and is distributed under
 // the University of Illinois Open Source License. See LICENSE.TXT for details.
-// 
+//
 //===----------------------------------------------------------------------===//
 //
 // This family of functions perform various local transformations to the
@@ -22,6 +22,7 @@ namespace llvm {
 class Pass;
 class PHINode;
 class AllocaInst;
+class ConstantExpr;
 
 //===----------------------------------------------------------------------===//
 //  Local constant propagation...
@@ -55,6 +56,10 @@ bool canConstantFoldCallTo(Function *F);
 /// with the specified arguments, returning null if unsuccessful.
 Constant *ConstantFoldCall(Function *F, const std::vector<Constant*> &Operands);
 
+/// ConstantFoldLoadThroughGEPConstantExpr - Given a constant and a
+/// getelementptr constantexpr, return the constant value being addressed by the
+/// constant expression, or null if something is funny and we can't decide.
+Constant *ConstantFoldLoadThroughGEPConstantExpr(Constant *C, ConstantExpr *CE);
 
 //===----------------------------------------------------------------------===//
 //  Local dead code elimination...
@@ -73,16 +78,6 @@ bool isInstructionTriviallyDead(Instruction *I);
 ///
 bool dceInstruction(BasicBlock::iterator &BBI);
 
-//===----------------------------------------------------------------------===//
-//  PHI Instruction Simplification
-//
-
-/// hasConstantValue - If the specified PHI node always merges together the same
-/// value, return the value, otherwise return null.
-///
-Value *hasConstantValue(PHINode *PN);
-
-
 //===----------------------------------------------------------------------===//
 //  Control Flow Graph Restructuring...
 //
@@ -103,7 +98,7 @@ bool SimplifyCFG(BasicBlock *BB);
 /// invalidating the SSA information for the value.  It returns the pointer to
 /// the alloca inserted to create a stack slot for X.
 ///
-AllocaInst *DemoteRegToStack(Instruction &X);
+AllocaInst *DemoteRegToStack(Instruction &X, bool VolatileLoads = false);
 
 } // End llvm namespace