Transform BU pass to not use the horrible DSCallSiteIterator class.
[oota-llvm.git] / lib / VMCore / Constants.cpp
index a77f8643ebb3b060a90907bc0446774b46abfc90..ee60f804b3cbd765d9962d3bb0d3726478db340b 100644 (file)
@@ -31,13 +31,6 @@ ConstantBool *ConstantBool::False = new ConstantBool(false);
 //                              Constant Class
 //===----------------------------------------------------------------------===//
 
-// Specialize setName to take care of symbol table majik
-void Constant::setName(const std::string &Name, SymbolTable *ST) {
-  assert(ST && "Type::setName - Must provide symbol table argument!");
-
-  if (Name.size()) ST->insert(Name, this);
-}
-
 void Constant::destroyConstantImpl() {
   // When a Constant is destroyed, there may be lingering
   // references to the constant by other constants in the constant pool.  These
@@ -228,7 +221,7 @@ ConstantInt::ConstantInt(const Type *Ty, uint64_t V) : ConstantIntegral(Ty, V) {
 
 ConstantSInt::ConstantSInt(const Type *Ty, int64_t V) : ConstantInt(Ty, V) {
   assert(Ty->isInteger() && Ty->isSigned() &&
-         "Illegal type for unsigned integer constant!");
+         "Illegal type for signed integer constant!");
   assert(isValueValidForType(Ty, V) && "Value too large for type!");
 }
 
@@ -1305,6 +1298,13 @@ Constant *ConstantExpr::getSizeOf(const Type *Ty) {
     Type::ULongTy);
 }
 
+Constant *ConstantExpr::getPtrPtrFromArrayPtr(Constant *C) {
+  // pointer from array is implemented as: getelementptr arr ptr, 0, 0
+  static std::vector<Constant*> Indices(2, ConstantUInt::get(Type::UIntTy, 0));
+
+  return ConstantExpr::getGetElementPtr(C, Indices);
+}
+
 Constant *ConstantExpr::getTy(const Type *ReqTy, unsigned Opcode,
                               Constant *C1, Constant *C2) {
   if (Opcode == Instruction::Shl || Opcode == Instruction::Shr)