Split ConstantVals.h into Constant.h and Constants.h


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2378 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/llvm/Constant.h b/include/llvm/Constant.h
new file mode 100644
index 0000000..572d1d1
--- /dev/null
+++ b/include/llvm/Constant.h
@@ -0,0 +1,47 @@
+//===-- llvm/Constant.h - Constant class definition --------------*- C++ -*--=//
+//
+// This file contains the declaration of the Constant class.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_CONSTANT_H
+#define LLVM_CONSTANT_H
+
+#include "llvm/User.h"
+
+class Constant : public User {
+protected:
+  inline Constant(const Type *Ty) : User(Ty, Value::ConstantVal) {}
+  ~Constant() {}
+
+  // destroyConstant - Called if some element of this constant is no longer
+  // valid.  At this point only other constants may be on the use_list for this
+  // constant.  Any constants on our Use list must also be destroy'd.  The
+  // implementation must be sure to remove the constant from the list of
+  // available cached constants.  Implementations should call
+  // destroyConstantImpl as the last thing they do, to destroy all users and
+  // delete this.
+  //
+  virtual void destroyConstant() { assert(0 && "Not reached!"); }
+  void destroyConstantImpl();
+public:
+  // Specialize setName to handle symbol table majik...
+  virtual void setName(const std::string &name, SymbolTable *ST = 0);
+
+  // Static constructor to get a '0' constant of arbitrary type...
+  static Constant *getNullValue(const Type *Ty);
+
+  // isNullValue - Return true if this is the value that would be returned by
+  // getNullValue.
+  virtual bool isNullValue() const = 0;
+
+  virtual void print(std::ostream &O) const;
+
+  // Methods for support type inquiry through isa, cast, and dyn_cast:
+  static inline bool classof(const Constant *) { return true; }
+  static inline bool classof(const Value *V) {
+    return V->getValueType() == Value::ConstantVal;
+  }
+};
+
+#endif
diff --git a/include/llvm/ConstantHandling.h b/include/llvm/ConstantHandling.h
index 1479fe0..14231cb 100644
--- a/include/llvm/ConstantHandling.h
+++ b/include/llvm/ConstantHandling.h
@@ -33,7 +33,7 @@
 #ifndef LLVM_CONSTANTHANDLING_H
 #define LLVM_CONSTANTHANDLING_H
 
-#include "llvm/ConstantVals.h"
+#include "llvm/Constants.h"
 #include "llvm/Instruction.h"
 #include "llvm/Type.h"
 class PointerType;
diff --git a/include/llvm/Constants.h b/include/llvm/Constants.h
index 1253974..119dd8f 100644
--- a/include/llvm/Constants.h
+++ b/include/llvm/Constants.h
@@ -1,65 +1,20 @@
-//===-- llvm/ConstantVals.h - Constant Value nodes ---------------*- C++ -*--=//
+//===-- llvm/Constants.h - Constant class subclass definitions ---*- C++ -*--=//
 //
-// This file contains the declarations for the Constant class and all of
-// its subclasses, which represent the different type of constant pool values
+// This file contains the declarations for the subclasses of Constant, which
+// represent the different type of constant pool values
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_CONSTANT_VALS_H
-#define LLVM_CONSTANT_VALS_H
+#ifndef LLVM_CONSTANTS_H
+#define LLVM_CONSTANTS_H
 
-#include "llvm/User.h"
+#include "llvm/Constant.h"
 #include "Support/DataTypes.h"
 
 class ArrayType;
 class StructType;
 class PointerType;
 
-//===----------------------------------------------------------------------===//
-//                                Constant Class
-//===----------------------------------------------------------------------===//
-
-class Constant : public User {
-protected:
-  inline Constant(const Type *Ty) : User(Ty, Value::ConstantVal) {}
-  ~Constant() {}
-
-  // destroyConstant - Called if some element of this constant is no longer
-  // valid.  At this point only other constants may be on the use_list for this
-  // constant.  Any constants on our Use list must also be destroy'd.  The
-  // implementation must be sure to remove the constant from the list of
-  // available cached constants.  Implementations should call
-  // destroyConstantImpl as the last thing they do, to destroy all users and
-  // delete this.
-  //
-  virtual void destroyConstant() { assert(0 && "Not reached!"); }
-  void destroyConstantImpl();
-public:
-  // Specialize setName to handle symbol table majik...
-  virtual void setName(const std::string &name, SymbolTable *ST = 0);
-
-  // Static constructor to get a '0' constant of arbitrary type...
-  static Constant *getNullValue(const Type *Ty);
-
-  // isNullValue - Return true if this is the value that would be returned by
-  // getNullValue.
-  virtual bool isNullValue() const = 0;
-
-  virtual void print(std::ostream &O) const;
-
-  // Methods for support type inquiry through isa, cast, and dyn_cast:
-  static inline bool classof(const Constant *) { return true; }
-  static inline bool classof(const Value *V) {
-    return V->getValueType() == Value::ConstantVal;
-  }
-};
-
-
-
-//===----------------------------------------------------------------------===//
-//              Classes to represent constant pool variable defs
-//===----------------------------------------------------------------------===//
-
 //===---------------------------------------------------------------------------
 // ConstantBool - Boolean Values
 //
diff --git a/lib/Analysis/DataStructure/FunctionRepBuilder.cpp b/lib/Analysis/DataStructure/FunctionRepBuilder.cpp
index e9b6f19..1566ca8 100644
--- a/lib/Analysis/DataStructure/FunctionRepBuilder.cpp
+++ b/lib/Analysis/DataStructure/FunctionRepBuilder.cpp
@@ -12,7 +12,7 @@
 #include "llvm/iOther.h"
 #include "llvm/iTerminators.h"
 #include "llvm/DerivedTypes.h"
-#include "llvm/ConstantVals.h"
+#include "llvm/Constants.h"
 #include "Support/STLExtras.h"
 #include <algorithm>
 
diff --git a/lib/Analysis/InductionVariable.cpp b/lib/Analysis/InductionVariable.cpp
index 3214b79..f0b01e8 100644
--- a/lib/Analysis/InductionVariable.cpp
+++ b/lib/Analysis/InductionVariable.cpp
@@ -22,7 +22,7 @@
 #include "llvm/iPHINode.h"
 #include "llvm/InstrTypes.h"
 #include "llvm/Type.h"
-#include "llvm/ConstantVals.h"
+#include "llvm/Constants.h"
 
 using analysis::ExprType;
 
diff --git a/lib/AsmParser/ParserInternals.h b/lib/AsmParser/ParserInternals.h
index 8b10c36..db84f92 100644
--- a/lib/AsmParser/ParserInternals.h
+++ b/lib/AsmParser/ParserInternals.h
@@ -13,7 +13,7 @@
 
 #include "llvm/InstrTypes.h"
 #include "llvm/BasicBlock.h"
-#include "llvm/ConstantVals.h"
+#include "llvm/Constants.h"
 #include "llvm/iOther.h"
 #include "llvm/Function.h"
 #include "llvm/DerivedTypes.h"
diff --git a/lib/Bytecode/Reader/ConstantReader.cpp b/lib/Bytecode/Reader/ConstantReader.cpp
index 89beddb..4c7ebb1 100644
--- a/lib/Bytecode/Reader/ConstantReader.cpp
+++ b/lib/Bytecode/Reader/ConstantReader.cpp
@@ -11,7 +11,7 @@
 #include "ReaderInternals.h"
 #include "llvm/Module.h"
 #include "llvm/BasicBlock.h"
-#include "llvm/ConstantVals.h"
+#include "llvm/Constants.h"
 #include "llvm/GlobalVariable.h"
 #include <algorithm>
 #include <iostream>
diff --git a/lib/Bytecode/Reader/Reader.cpp b/lib/Bytecode/Reader/Reader.cpp
index fff2d02..7418c81 100644
--- a/lib/Bytecode/Reader/Reader.cpp
+++ b/lib/Bytecode/Reader/Reader.cpp
@@ -16,7 +16,7 @@
 #include "llvm/GlobalVariable.h"
 #include "llvm/Module.h"
 #include "llvm/BasicBlock.h"
-#include "llvm/ConstantVals.h"
+#include "llvm/Constants.h"
 #include "llvm/iPHINode.h"
 #include "llvm/iOther.h"
 #include "llvm/Argument.h"
diff --git a/lib/Bytecode/Writer/ConstantWriter.cpp b/lib/Bytecode/Writer/ConstantWriter.cpp
index 296e326..d85ee2f 100644
--- a/lib/Bytecode/Writer/ConstantWriter.cpp
+++ b/lib/Bytecode/Writer/ConstantWriter.cpp
@@ -10,7 +10,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "WriterInternals.h"
-#include "llvm/ConstantVals.h"
+#include "llvm/Constants.h"
 #include "llvm/SymbolTable.h"
 #include "llvm/DerivedTypes.h"
 #include <iostream>
diff --git a/lib/Bytecode/Writer/SlotCalculator.cpp b/lib/Bytecode/Writer/SlotCalculator.cpp
index ce62df9..6dad926 100644
--- a/lib/Bytecode/Writer/SlotCalculator.cpp
+++ b/lib/Bytecode/Writer/SlotCalculator.cpp
@@ -15,8 +15,8 @@
 #include "llvm/GlobalVariable.h"
 #include "llvm/Module.h"
 #include "llvm/BasicBlock.h"
-#include "llvm/ConstantVals.h"
 #include "llvm/iOther.h"
+#include "llvm/Constant.h"
 #include "llvm/DerivedTypes.h"
 #include "llvm/SymbolTable.h"
 #include "llvm/Argument.h"
diff --git a/lib/Bytecode/Writer/Writer.cpp b/lib/Bytecode/Writer/Writer.cpp
index 2f42777..145004b 100644
--- a/lib/Bytecode/Writer/Writer.cpp
+++ b/lib/Bytecode/Writer/Writer.cpp
@@ -24,7 +24,6 @@
 #include "llvm/GlobalVariable.h"
 #include "llvm/Function.h"
 #include "llvm/BasicBlock.h"
-#include "llvm/ConstantVals.h"
 #include "llvm/SymbolTable.h"
 #include "llvm/DerivedTypes.h"
 #include "Support/STLExtras.h"
@@ -78,8 +77,8 @@
 
     unsigned NC = ValNo;              // Number of constants
     for (; NC < Plane.size() && 
-	   (isa<Constant>(Plane[NC]) || 
-            isa<Type>(Plane[NC])); NC++) /*empty*/;
+	   (isa<Constant>(Plane[NC]) || isa<Type>(Plane[NC])); NC++)
+      /*empty*/;
     NC -= ValNo;                      // Convert from index into count
     if (NC == 0) continue;            // Skip empty type planes...
 
@@ -125,7 +124,7 @@
 
     // If we have an initializer, output it now.
     if (GV->hasInitializer()) {
-      Slot = Table.getValSlot(GV->getInitializer());
+      Slot = Table.getValSlot((Value*)GV->getInitializer());
       assert(Slot != -1 && "No slot for global var initializer!");
       output_vbr((unsigned)Slot, Out);
     }
diff --git a/lib/CodeGen/InstrSelection/InstrForest.cpp b/lib/CodeGen/InstrSelection/InstrForest.cpp
index e2f45a0..8fa5958 100644
--- a/lib/CodeGen/InstrSelection/InstrForest.cpp
+++ b/lib/CodeGen/InstrSelection/InstrForest.cpp
@@ -24,7 +24,7 @@
 #include "llvm/Function.h"
 #include "llvm/iTerminators.h"
 #include "llvm/iMemory.h"
-#include "llvm/ConstantVals.h"
+#include "llvm/Constant.h"
 #include "llvm/BasicBlock.h"
 #include "llvm/CodeGen/MachineInstr.h"
 #include "Support/STLExtras.h"
diff --git a/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp b/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp
index 24efdf1..c042e36 100644
--- a/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp
+++ b/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp
@@ -19,7 +19,7 @@
 #include "llvm/CodeGen/InstrForest.h"
 #include "llvm/Target/TargetMachine.h"
 #include "llvm/Target/MachineRegInfo.h"
-#include "llvm/ConstantVals.h"
+#include "llvm/Constants.h"
 #include "llvm/Function.h"
 #include "llvm/BasicBlock.h"
 #include "llvm/Type.h"
diff --git a/lib/ExecutionEngine/Interpreter/Execution.cpp b/lib/ExecutionEngine/Interpreter/Execution.cpp
index 91f3e89..321003c 100644
--- a/lib/ExecutionEngine/Interpreter/Execution.cpp
+++ b/lib/ExecutionEngine/Interpreter/Execution.cpp
@@ -11,7 +11,7 @@
 #include "llvm/iTerminators.h"
 #include "llvm/iMemory.h"
 #include "llvm/Type.h"
-#include "llvm/ConstantVals.h"
+#include "llvm/Constants.h"
 #include "llvm/Assembly/Writer.h"
 #include "llvm/Target/TargetData.h"
 #include "llvm/GlobalVariable.h"
diff --git a/lib/Linker/LinkModules.cpp b/lib/Linker/LinkModules.cpp
index 086c6c6..2de6f81 100644
--- a/lib/Linker/LinkModules.cpp
+++ b/lib/Linker/LinkModules.cpp
@@ -17,7 +17,7 @@
 #include "llvm/SymbolTable.h"
 #include "llvm/DerivedTypes.h"
 #include "llvm/iOther.h"
-#include "llvm/ConstantVals.h"
+#include "llvm/Constants.h"
 #include "llvm/Argument.h"
 #include <iostream>
 using std::cerr;
diff --git a/lib/Target/SparcV9/InstrSelection/InstrForest.cpp b/lib/Target/SparcV9/InstrSelection/InstrForest.cpp
index e2f45a0..8fa5958 100644
--- a/lib/Target/SparcV9/InstrSelection/InstrForest.cpp
+++ b/lib/Target/SparcV9/InstrSelection/InstrForest.cpp
@@ -24,7 +24,7 @@
 #include "llvm/Function.h"
 #include "llvm/iTerminators.h"
 #include "llvm/iMemory.h"
-#include "llvm/ConstantVals.h"
+#include "llvm/Constant.h"
 #include "llvm/BasicBlock.h"
 #include "llvm/CodeGen/MachineInstr.h"
 #include "Support/STLExtras.h"
diff --git a/lib/Target/SparcV9/InstrSelection/InstrSelectionSupport.cpp b/lib/Target/SparcV9/InstrSelection/InstrSelectionSupport.cpp
index 24efdf1..c042e36 100644
--- a/lib/Target/SparcV9/InstrSelection/InstrSelectionSupport.cpp
+++ b/lib/Target/SparcV9/InstrSelection/InstrSelectionSupport.cpp
@@ -19,7 +19,7 @@
 #include "llvm/CodeGen/InstrForest.h"
 #include "llvm/Target/TargetMachine.h"
 #include "llvm/Target/MachineRegInfo.h"
-#include "llvm/ConstantVals.h"
+#include "llvm/Constants.h"
 #include "llvm/Function.h"
 #include "llvm/BasicBlock.h"
 #include "llvm/Type.h"
diff --git a/lib/Target/SparcV9/SparcV9AsmPrinter.cpp b/lib/Target/SparcV9/SparcV9AsmPrinter.cpp
index 77c9d31..c823e91 100644
--- a/lib/Target/SparcV9/SparcV9AsmPrinter.cpp
+++ b/lib/Target/SparcV9/SparcV9AsmPrinter.cpp
@@ -15,7 +15,7 @@
 #include "llvm/CodeGen/MachineInstr.h"
 #include "llvm/CodeGen/MachineCodeForMethod.h"
 #include "llvm/GlobalVariable.h"
-#include "llvm/ConstantVals.h"
+#include "llvm/Constants.h"
 #include "llvm/DerivedTypes.h"
 #include "llvm/Annotation.h"
 #include "llvm/BasicBlock.h"
@@ -307,13 +307,13 @@
         const Value *Val = op.getVRegValue();
         if (!Val)
           toAsm << "\t<*NULL Value*>";
-        else if (const BasicBlock *BB = dyn_cast<const BasicBlock>(Val))
+        else if (const BasicBlock *BB = dyn_cast<BasicBlock>(Val))
           toAsm << getID(BB);
-        else if (const Function *M = dyn_cast<const Function>(Val))
+        else if (const Function *M = dyn_cast<Function>(Val))
           toAsm << getID(M);
-        else if (const GlobalVariable *GV=dyn_cast<const GlobalVariable>(Val))
+        else if (const GlobalVariable *GV = dyn_cast<GlobalVariable>(Val))
           toAsm << getID(GV);
-        else if (const Constant *CV = dyn_cast<const Constant>(Val))
+        else if (const Constant *CV = dyn_cast<Constant>(Val))
           toAsm << getID(CV);
         else
           toAsm << "<unknown value=" << Val << ">";
diff --git a/lib/Target/SparcV9/SparcV9InstrInfo.cpp b/lib/Target/SparcV9/SparcV9InstrInfo.cpp
index aa618c9..354c39a 100644
--- a/lib/Target/SparcV9/SparcV9InstrInfo.cpp
+++ b/lib/Target/SparcV9/SparcV9InstrInfo.cpp
@@ -18,7 +18,7 @@
 #include "llvm/CodeGen/MachineInstr.h"
 #include "llvm/CodeGen/MachineCodeForMethod.h"
 #include "llvm/Function.h"
-#include "llvm/ConstantVals.h"
+#include "llvm/Constants.h"
 #include "llvm/DerivedTypes.h"
 
 
diff --git a/lib/Target/SparcV9/SparcV9InstrSelection.cpp b/lib/Target/SparcV9/SparcV9InstrSelection.cpp
index cff0a84..7054ae9 100644
--- a/lib/Target/SparcV9/SparcV9InstrSelection.cpp
+++ b/lib/Target/SparcV9/SparcV9InstrSelection.cpp
@@ -25,7 +25,7 @@
 #include "llvm/iOther.h"
 #include "llvm/BasicBlock.h"
 #include "llvm/Function.h"
-#include "llvm/ConstantVals.h"
+#include "llvm/Constants.h"
 #include "Support/MathExtras.h"
 #include <math.h>
 using std::vector;
diff --git a/lib/Target/TargetData.cpp b/lib/Target/TargetData.cpp
index d347730..8479c6c 100644
--- a/lib/Target/TargetData.cpp
+++ b/lib/Target/TargetData.cpp
@@ -12,7 +12,7 @@
 
 #include "llvm/Target/TargetData.h"
 #include "llvm/DerivedTypes.h"
-#include "llvm/ConstantVals.h"
+#include "llvm/Constants.h"
 
 static inline void getTypeInfo(const Type *Ty, const TargetData *TD,
 			       unsigned &Size, unsigned char &Alignment);
diff --git a/lib/Transforms/ExprTypeConvert.cpp b/lib/Transforms/ExprTypeConvert.cpp
index 181ff70..cd14bb3 100644
--- a/lib/Transforms/ExprTypeConvert.cpp
+++ b/lib/Transforms/ExprTypeConvert.cpp
@@ -11,7 +11,7 @@
 #include "llvm/iOther.h"
 #include "llvm/iPHINode.h"
 #include "llvm/iMemory.h"
-#include "llvm/ConstantVals.h"
+#include "llvm/Constants.h"
 #include "llvm/ConstantHandling.h"
 #include "llvm/Transforms/Scalar/DCE.h"
 #include "llvm/Analysis/Expressions.h"
diff --git a/lib/Transforms/IPO/MutateStructTypes.cpp b/lib/Transforms/IPO/MutateStructTypes.cpp
index 2a6d184..5cb3ee0 100644
--- a/lib/Transforms/IPO/MutateStructTypes.cpp
+++ b/lib/Transforms/IPO/MutateStructTypes.cpp
@@ -23,6 +23,7 @@
 #include "llvm/iTerminators.h"
 #include "llvm/iOther.h"
 #include "llvm/Argument.h"
+#include "llvm/Constants.h"
 #include "Support/STLExtras.h"
 #include <algorithm>
 using std::map;
diff --git a/lib/Transforms/IPO/OldPoolAllocate.cpp b/lib/Transforms/IPO/OldPoolAllocate.cpp
index bd67fe1..6ccd043 100644
--- a/lib/Transforms/IPO/OldPoolAllocate.cpp
+++ b/lib/Transforms/IPO/OldPoolAllocate.cpp
@@ -21,7 +21,7 @@
 #include "llvm/iPHINode.h"
 #include "llvm/iOther.h"
 #include "llvm/DerivedTypes.h"
-#include "llvm/ConstantVals.h"
+#include "llvm/Constants.h"
 #include "llvm/Target/TargetData.h"
 #include "llvm/Support/InstVisitor.h"
 #include "llvm/Argument.h"
diff --git a/lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp b/lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp
index 41d4a72..0b6d17d 100644
--- a/lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp
+++ b/lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp
@@ -9,7 +9,7 @@
 
 #include "Graph.h"
 #include "llvm/BasicBlock.h"
-#include "llvm/ConstantVals.h"
+#include "llvm/Constants.h"
 #include "llvm/DerivedTypes.h"
 #include "llvm/iMemory.h"
 #include "llvm/iTerminators.h"
diff --git a/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp b/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp
index b967db6..26fa866 100644
--- a/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp
+++ b/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp
@@ -29,7 +29,7 @@
 #include "llvm/Support/CFG.h"
 #include "llvm/Function.h"
 #include "llvm/BasicBlock.h"
-#include "llvm/ConstantVals.h"
+#include "llvm/Constants.h"
 #include "llvm/DerivedTypes.h"
 #include "llvm/iMemory.h"
 #include "llvm/Pass.h"
diff --git a/lib/Transforms/Instrumentation/TraceValues.cpp b/lib/Transforms/Instrumentation/TraceValues.cpp
index d05d33d..7b263c7 100644
--- a/lib/Transforms/Instrumentation/TraceValues.cpp
+++ b/lib/Transforms/Instrumentation/TraceValues.cpp
@@ -7,7 +7,7 @@
 
 #include "llvm/Transforms/Instrumentation/TraceValues.h"
 #include "llvm/GlobalVariable.h"
-#include "llvm/ConstantVals.h"
+#include "llvm/Constants.h"
 #include "llvm/DerivedTypes.h"
 #include "llvm/iMemory.h"
 #include "llvm/iTerminators.h"
diff --git a/lib/Transforms/LevelRaise.cpp b/lib/Transforms/LevelRaise.cpp
index f556ced..77d06a0 100644
--- a/lib/Transforms/LevelRaise.cpp
+++ b/lib/Transforms/LevelRaise.cpp
@@ -11,7 +11,7 @@
 #include "llvm/Function.h"
 #include "llvm/iOther.h"
 #include "llvm/iMemory.h"
-#include "llvm/ConstantVals.h"
+#include "llvm/Constants.h"
 #include "llvm/Pass.h"
 #include "llvm/ConstantHandling.h"
 #include "llvm/Transforms/Scalar/DCE.h"
diff --git a/lib/Transforms/Scalar/ConstantProp.cpp b/lib/Transforms/Scalar/ConstantProp.cpp
index a8cd02f..0f1d0ae 100644
--- a/lib/Transforms/Scalar/ConstantProp.cpp
+++ b/lib/Transforms/Scalar/ConstantProp.cpp
@@ -30,7 +30,6 @@
 #include "llvm/iPHINode.h"
 #include "llvm/iOther.h"
 #include "llvm/Pass.h"
-#include "llvm/ConstantVals.h"
 
 inline static bool 
 ConstantFoldUnaryInst(BasicBlock *BB, BasicBlock::iterator &II,
diff --git a/lib/Transforms/Scalar/DCE.cpp b/lib/Transforms/Scalar/DCE.cpp
index 0d6f293..1a3073c 100644
--- a/lib/Transforms/Scalar/DCE.cpp
+++ b/lib/Transforms/Scalar/DCE.cpp
@@ -30,7 +30,7 @@
 #include "llvm/BasicBlock.h"
 #include "llvm/iTerminators.h"
 #include "llvm/iPHINode.h"
-#include "llvm/ConstantVals.h"
+#include "llvm/Constant.h"
 #include "llvm/Support/CFG.h"
 #include "llvm/Pass.h"
 #include "Support/STLExtras.h"
diff --git a/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp b/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp
index 0ec72c6..78dcfd5 100644
--- a/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp
+++ b/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp
@@ -10,7 +10,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Transforms/Scalar/DecomposeMultiDimRefs.h"
-#include "llvm/ConstantVals.h"
+#include "llvm/Constants.h"
 #include "llvm/iMemory.h"
 #include "llvm/iOther.h"
 #include "llvm/BasicBlock.h"
diff --git a/lib/Transforms/Scalar/IndVarSimplify.cpp b/lib/Transforms/Scalar/IndVarSimplify.cpp
index d9b8415..a115e05 100644
--- a/lib/Transforms/Scalar/IndVarSimplify.cpp
+++ b/lib/Transforms/Scalar/IndVarSimplify.cpp
@@ -12,7 +12,7 @@
 #include "llvm/iOther.h"
 #include "llvm/Type.h"
 #include "llvm/BasicBlock.h"
-#include "llvm/ConstantVals.h"
+#include "llvm/Constants.h"
 #include "llvm/Pass.h"
 #include "llvm/Support/CFG.h"
 #include "Support/STLExtras.h"
diff --git a/lib/Transforms/Scalar/InductionVars.cpp b/lib/Transforms/Scalar/InductionVars.cpp
index 0225cd5..ee7c4c8 100644
--- a/lib/Transforms/Scalar/InductionVars.cpp
+++ b/lib/Transforms/Scalar/InductionVars.cpp
@@ -20,7 +20,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Transforms/Scalar/InductionVars.h"
-#include "llvm/ConstantVals.h"
+#include "llvm/Constants.h"
 #include "llvm/Analysis/IntervalPartition.h"
 #include "llvm/iPHINode.h"
 #include "llvm/Function.h"
diff --git a/lib/Transforms/Scalar/SCCP.cpp b/lib/Transforms/Scalar/SCCP.cpp
index e723fc8..c68004d 100644
--- a/lib/Transforms/Scalar/SCCP.cpp
+++ b/lib/Transforms/Scalar/SCCP.cpp
@@ -19,7 +19,7 @@
 #include "llvm/ConstantHandling.h"
 #include "llvm/Function.h"
 #include "llvm/BasicBlock.h"
-#include "llvm/ConstantVals.h"
+#include "llvm/Constants.h"
 #include "llvm/iPHINode.h"
 #include "llvm/iMemory.h"
 #include "llvm/iTerminators.h"
diff --git a/lib/Transforms/TransformInternals.cpp b/lib/Transforms/TransformInternals.cpp
index 55b9dda..e5a88c5 100644
--- a/lib/Transforms/TransformInternals.cpp
+++ b/lib/Transforms/TransformInternals.cpp
@@ -7,7 +7,6 @@
 
 #include "TransformInternals.h"
 #include "llvm/Type.h"
-#include "llvm/ConstantVals.h"
 #include "llvm/Analysis/Expressions.h"
 #include "llvm/Function.h"
 #include "llvm/iOther.h"
diff --git a/lib/Transforms/TransformInternals.h b/lib/Transforms/TransformInternals.h
index a93f63e..f57ed3e 100644
--- a/lib/Transforms/TransformInternals.h
+++ b/lib/Transforms/TransformInternals.h
@@ -12,7 +12,7 @@
 #include "llvm/Instruction.h"
 #include "llvm/Target/TargetData.h"
 #include "llvm/DerivedTypes.h"
-#include "llvm/ConstantVals.h"
+#include "llvm/Constants.h"
 #include <map>
 #include <set>
 
diff --git a/lib/Transforms/Utils/Linker.cpp b/lib/Transforms/Utils/Linker.cpp
index 086c6c6..2de6f81 100644
--- a/lib/Transforms/Utils/Linker.cpp
+++ b/lib/Transforms/Utils/Linker.cpp
@@ -17,7 +17,7 @@
 #include "llvm/SymbolTable.h"
 #include "llvm/DerivedTypes.h"
 #include "llvm/iOther.h"
-#include "llvm/ConstantVals.h"
+#include "llvm/Constants.h"
 #include "llvm/Argument.h"
 #include <iostream>
 using std::cerr;
diff --git a/lib/Transforms/Utils/LowerAllocations.cpp b/lib/Transforms/Utils/LowerAllocations.cpp
index 42524c8..21456a2 100644
--- a/lib/Transforms/Utils/LowerAllocations.cpp
+++ b/lib/Transforms/Utils/LowerAllocations.cpp
@@ -14,7 +14,7 @@
 #include "llvm/DerivedTypes.h"
 #include "llvm/iMemory.h"
 #include "llvm/iOther.h"
-#include "llvm/ConstantVals.h"
+#include "llvm/Constants.h"
 #include "llvm/Pass.h"
 #include "TransformInternals.h"
 using std::vector;
diff --git a/lib/Transforms/Utils/PromoteMemoryToRegister.cpp b/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
index 8679701..ab94550 100644
--- a/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
+++ b/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
@@ -25,7 +25,7 @@
 #include "llvm/Pass.h"
 #include "llvm/Function.h"
 #include "llvm/BasicBlock.h"
-#include "llvm/ConstantVals.h"
+#include "llvm/Constant.h"
 
 using std::vector;
 using std::map;
@@ -79,7 +79,7 @@
       if (MAI->hasIndices()) {  // indexed?
         // Allow the access if there is only one index and the index is
         // zero.
-        if (*MAI->idx_begin() != ConstantUInt::get(Type::UIntTy, 0) ||
+        if (*MAI->idx_begin() != Constant::getNullValue(Type::UIntTy) ||
             MAI->idx_begin()+1 != MAI->idx_end())
           return false;
       }
diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp
index 51ffbf6..316baf1 100644
--- a/lib/VMCore/AsmWriter.cpp
+++ b/lib/VMCore/AsmWriter.cpp
@@ -18,7 +18,7 @@
 #include "llvm/Function.h"
 #include "llvm/GlobalVariable.h"
 #include "llvm/BasicBlock.h"
-#include "llvm/ConstantVals.h"
+#include "llvm/Constants.h"
 #include "llvm/iMemory.h"
 #include "llvm/iTerminators.h"
 #include "llvm/iPHINode.h"
diff --git a/lib/VMCore/BasicBlock.cpp b/lib/VMCore/BasicBlock.cpp
index e126d70..bd750df 100644
--- a/lib/VMCore/BasicBlock.cpp
+++ b/lib/VMCore/BasicBlock.cpp
@@ -76,7 +76,7 @@
 //
 bool BasicBlock::hasConstantReferences() const {
   for (use_const_iterator I = use_begin(), E = use_end(); I != E; ++I)
-    if (::isa<Constant>(*I))
+    if (::isa<Constant>((Value*)*I))
       return true;
 
   return false;
diff --git a/lib/VMCore/ConstantFold.h b/lib/VMCore/ConstantFold.h
index 1479fe0..14231cb 100644
--- a/lib/VMCore/ConstantFold.h
+++ b/lib/VMCore/ConstantFold.h
@@ -33,7 +33,7 @@
 #ifndef LLVM_CONSTANTHANDLING_H
 #define LLVM_CONSTANTHANDLING_H
 
-#include "llvm/ConstantVals.h"
+#include "llvm/Constants.h"
 #include "llvm/Instruction.h"
 #include "llvm/Type.h"
 class PointerType;
diff --git a/lib/VMCore/ConstantFolding.h b/lib/VMCore/ConstantFolding.h
index 1479fe0..14231cb 100644
--- a/lib/VMCore/ConstantFolding.h
+++ b/lib/VMCore/ConstantFolding.h
@@ -33,7 +33,7 @@
 #ifndef LLVM_CONSTANTHANDLING_H
 #define LLVM_CONSTANTHANDLING_H
 
-#include "llvm/ConstantVals.h"
+#include "llvm/Constants.h"
 #include "llvm/Instruction.h"
 #include "llvm/Type.h"
 class PointerType;
diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp
index 8bf1d9c..7487bb4 100644
--- a/lib/VMCore/Constants.cpp
+++ b/lib/VMCore/Constants.cpp
@@ -1,11 +1,11 @@
-//===-- ConstantVals.cpp - Implement Constant nodes --------------*- C++ -*--=//
+//===-- Constants.cpp - Implement Constant nodes -----------------*- C++ -*--=//
 //
 // This file implements the Constant* classes...
 //
 //===----------------------------------------------------------------------===//
 
 #define __STDC_LIMIT_MACROS           // Get defs for INT64_MAX and friends...
-#include "llvm/ConstantVals.h"
+#include "llvm/Constants.h"
 #include "llvm/DerivedTypes.h"
 #include "llvm/SymbolTable.h"
 #include "llvm/GlobalValue.h"
diff --git a/lib/VMCore/Linker.cpp b/lib/VMCore/Linker.cpp
index 086c6c6..2de6f81 100644
--- a/lib/VMCore/Linker.cpp
+++ b/lib/VMCore/Linker.cpp
@@ -17,7 +17,7 @@
 #include "llvm/SymbolTable.h"
 #include "llvm/DerivedTypes.h"
 #include "llvm/iOther.h"
-#include "llvm/ConstantVals.h"
+#include "llvm/Constants.h"
 #include "llvm/Argument.h"
 #include <iostream>
 using std::cerr;
diff --git a/lib/VMCore/Module.cpp b/lib/VMCore/Module.cpp
index 08bc387..f06c9e3 100644
--- a/lib/VMCore/Module.cpp
+++ b/lib/VMCore/Module.cpp
@@ -9,7 +9,7 @@
 #include "llvm/GlobalVariable.h"
 #include "llvm/InstrTypes.h"
 #include "llvm/Type.h"
-#include "llvm/ConstantVals.h"
+#include "llvm/Constants.h"
 #include "llvm/DerivedTypes.h"
 #include "Support/STLExtras.h"
 #include "ValueHolderImpl.h"
diff --git a/lib/VMCore/SlotCalculator.cpp b/lib/VMCore/SlotCalculator.cpp
index ce62df9..6dad926 100644
--- a/lib/VMCore/SlotCalculator.cpp
+++ b/lib/VMCore/SlotCalculator.cpp
@@ -15,8 +15,8 @@
 #include "llvm/GlobalVariable.h"
 #include "llvm/Module.h"
 #include "llvm/BasicBlock.h"
-#include "llvm/ConstantVals.h"
 #include "llvm/iOther.h"
+#include "llvm/Constant.h"
 #include "llvm/DerivedTypes.h"
 #include "llvm/SymbolTable.h"
 #include "llvm/Argument.h"
diff --git a/lib/VMCore/Type.cpp b/lib/VMCore/Type.cpp
index 7a17d06..3ea928e 100644
--- a/lib/VMCore/Type.cpp
+++ b/lib/VMCore/Type.cpp
@@ -6,6 +6,7 @@
 
 #include "llvm/DerivedTypes.h"
 #include "llvm/SymbolTable.h"
+#include "llvm/Constants.h"
 #include "Support/StringExtras.h"
 #include "Support/STLExtras.h"
 #include <iostream>
diff --git a/lib/VMCore/iMemory.cpp b/lib/VMCore/iMemory.cpp
index 79c697e..09d9d15 100644
--- a/lib/VMCore/iMemory.cpp
+++ b/lib/VMCore/iMemory.cpp
@@ -5,7 +5,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/iMemory.h"
-#include "llvm/ConstantVals.h"
+#include "llvm/Constants.h"
 
 static inline const Type *checkType(const Type *Ty) {
   assert(Ty && "Invalid indices for type!");