// 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
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!");
}
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)