return cast<Constant>(getValue());
}
inline const Constant *getConstant() const {
- return cast<const Constant>(getValue());
+ return cast<Constant>(getValue());
}
inline BasicBlock *getBasicBlock() {
return cast<BasicBlock>(getValue());
}
inline const BasicBlock *getBasicBlock() const {
- return cast<const BasicBlock>(getValue());
+ return cast<BasicBlock>(getValue());
}
inline Instruction *getInstruction() {
assert(isInstruction() && "getInstruction() on non instruction node!");
return T->getPrimitiveID() == FunctionTyID;
}
static inline bool classof(const Value *V) {
- return isa<Type>(V) && classof(cast<const Type>(V));
+ return isa<Type>(V) && classof(cast<Type>(V));
}
};
T->getPrimitiveID() == PointerTyID;
}
static inline bool classof(const Value *V) {
- return isa<Type>(V) && classof(cast<const Type>(V));
+ return isa<Type>(V) && classof(cast<Type>(V));
}
};
return T->getPrimitiveID() == StructTyID;
}
static inline bool classof(const Value *V) {
- return isa<Type>(V) && classof(cast<const Type>(V));
+ return isa<Type>(V) && classof(cast<Type>(V));
}
};
T->getPrimitiveID() == PointerTyID;
}
static inline bool classof(const Value *V) {
- return isa<Type>(V) && classof(cast<const Type>(V));
+ return isa<Type>(V) && classof(cast<Type>(V));
}
};
return T->getPrimitiveID() == ArrayTyID;
}
static inline bool classof(const Value *V) {
- return isa<Type>(V) && classof(cast<const Type>(V));
+ return isa<Type>(V) && classof(cast<Type>(V));
}
};
return T->getPrimitiveID() == PointerTyID;
}
static inline bool classof(const Value *V) {
- return isa<Type>(V) && classof(cast<const Type>(V));
+ return isa<Type>(V) && classof(cast<Type>(V));
}
};
}
D.destroy(); // Free old strdup'd memory...
- return cast<const Type>(N);
+ return cast<Type>(N);
}
default:
ThrowException("Internal parser error: Invalid symbol type reference!");
if (Existing) { // Inserting a name that is already defined???
// There is only one case where this is allowed: when we are refining an
// opaque type. In this case, Existing will be an opaque type.
- if (const Type *Ty = dyn_cast<const Type>(Existing)) {
+ if (const Type *Ty = dyn_cast<Type>(Existing)) {
if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Ty)) {
// We ARE replacing an opaque type!
((OpaqueType*)OpTy)->refineAbstractTypeTo(cast<Type>(V));
if (const Type *Ty = dyn_cast<Type>(Existing)) {
if (Ty == cast<Type>(V)) return true; // Yes, it's equal.
// std::cerr << "Type: " << Ty->getDescription() << " != "
- // << cast<const Type>(V)->getDescription() << "!\n";
+ // << cast<Type>(V)->getDescription() << "!\n";
} else if (const Constant *C = dyn_cast<Constant>(Existing)) {
if (C == V) return true; // Constants are equal to themselves
} else if (GlobalVariable *EGV = dyn_cast<GlobalVariable>(Existing)) {
// ResolvedVal, ValueRef and ConstValueRef productions.
//
ConstVal: Types '[' ConstVector ']' { // Nonempty unsized arr
- const ArrayType *ATy = dyn_cast<const ArrayType>($1->get());
+ const ArrayType *ATy = dyn_cast<ArrayType>($1->get());
if (ATy == 0)
ThrowException("Cannot make array constant with type: '" +
(*$1)->getDescription() + "'!");
delete $1; delete $3;
}
| Types '[' ']' {
- const ArrayType *ATy = dyn_cast<const ArrayType>($1->get());
+ const ArrayType *ATy = dyn_cast<ArrayType>($1->get());
if (ATy == 0)
ThrowException("Cannot make array constant with type: '" +
(*$1)->getDescription() + "'!");
delete $1;
}
| Types 'c' STRINGCONSTANT {
- const ArrayType *ATy = dyn_cast<const ArrayType>($1->get());
+ const ArrayType *ATy = dyn_cast<ArrayType>($1->get());
if (ATy == 0)
ThrowException("Cannot make array constant with type: '" +
(*$1)->getDescription() + "'!");
delete $1;
}
| Types '{' ConstVector '}' {
- const StructType *STy = dyn_cast<const StructType>($1->get());
+ const StructType *STy = dyn_cast<StructType>($1->get());
if (STy == 0)
ThrowException("Cannot make struct constant with type: '" +
(*$1)->getDescription() + "'!");
delete $1; delete $3;
}
| Types '{' '}' {
- const StructType *STy = dyn_cast<const StructType>($1->get());
+ const StructType *STy = dyn_cast<StructType>($1->get());
if (STy == 0)
ThrowException("Cannot make struct constant with type: '" +
(*$1)->getDescription() + "'!");
delete $1;
}
| Types NULL_TOK {
- const PointerType *PTy = dyn_cast<const PointerType>($1->get());
+ const PointerType *PTy = dyn_cast<PointerType>($1->get());
if (PTy == 0)
ThrowException("Cannot make null pointer constant with type: '" +
(*$1)->getDescription() + "'!");
delete $1;
}
| Types SymbolicValueRef {
- const PointerType *Ty = dyn_cast<const PointerType>($1->get());
+ const PointerType *Ty = dyn_cast<PointerType>($1->get());
if (Ty == 0)
ThrowException("Global const reference must be a pointer type!");
abort();
case Type::ArrayTyID: {
- const ArrayType *AT = cast<const ArrayType>(Ty);
+ const ArrayType *AT = cast<ArrayType>(Ty);
unsigned NumElements = AT->getNumElements();
std::vector<Constant*> Elements;
}
case Type::PointerTyID: {
- const PointerType *PT = cast<const PointerType>(Ty);
+ const PointerType *PT = cast<PointerType>(Ty);
unsigned SubClass;
if (HasImplicitZeroInitializer)
SubClass = 1;
}
// If it's a type, make sure that all subtypes of the type are included...
- if (const Type *TheTy = dyn_cast<const Type>(D)) {
+ if (const Type *TheTy = dyn_cast<Type>(D)) {
// Insert the current type before any subtypes. This is important because
// recursive types elements are inserted in a bottom up order. Changing
const Value *Val = mop.getVRegValue();
assert(Val && "\tNULL Value in SparcFunctionAsmPrinter");
- if (const BasicBlock *BB = dyn_cast<const BasicBlock>(Val))
+ if (const BasicBlock *BB = dyn_cast<BasicBlock>(Val))
toAsm << getID(BB);
else if (const Function *M = dyn_cast<Function>(Val))
toAsm << getID(M);
void *D) {
const TargetData &TD = *(const TargetData*)D;
assert(AID == TD.AID && "Target data annotation ID mismatch!");
- const Type *Ty = cast<const Type>((const Value *)T);
+ const Type *Ty = cast<Type>((const Value *)T);
assert(isa<StructType>(Ty) &&
"Can only create StructLayout annotation on structs!");
- return new StructLayout((const StructType *)Ty, TD);
+ return new StructLayout(cast<StructType>(Ty), TD);
}
//===----------------------------------------------------------------------===//
SlotCalculator *Table);
static const Module *getModuleFromVal(const Value *V) {
- if (const Argument *MA = dyn_cast<const Argument>(V))
+ if (const Argument *MA = dyn_cast<Argument>(V))
return MA->getParent() ? MA->getParent()->getParent() : 0;
- else if (const BasicBlock *BB = dyn_cast<const BasicBlock>(V))
+ else if (const BasicBlock *BB = dyn_cast<BasicBlock>(V))
return BB->getParent() ? BB->getParent()->getParent() : 0;
- else if (const Instruction *I = dyn_cast<const Instruction>(V)) {
+ else if (const Instruction *I = dyn_cast<Instruction>(V)) {
const Function *M = I->getParent() ? I->getParent()->getParent() : 0;
return M ? M->getParent() : 0;
- } else if (const GlobalValue *GV = dyn_cast<const GlobalValue>(V))
+ } else if (const GlobalValue *GV = dyn_cast<GlobalValue>(V))
return GV->getParent();
return 0;
}
static SlotCalculator *createSlotCalculator(const Value *V) {
assert(!isa<Type>(V) && "Can't create an SC for a type!");
- if (const Argument *FA = dyn_cast<const Argument>(V)) {
+ if (const Argument *FA = dyn_cast<Argument>(V)) {
return new SlotCalculator(FA->getParent(), true);
- } else if (const Instruction *I = dyn_cast<const Instruction>(V)) {
+ } else if (const Instruction *I = dyn_cast<Instruction>(V)) {
return new SlotCalculator(I->getParent()->getParent(), true);
- } else if (const BasicBlock *BB = dyn_cast<const BasicBlock>(V)) {
+ } else if (const BasicBlock *BB = dyn_cast<BasicBlock>(V)) {
return new SlotCalculator(BB->getParent(), true);
- } else if (const GlobalVariable *GV = dyn_cast<const GlobalVariable>(V)){
+ } else if (const GlobalVariable *GV = dyn_cast<GlobalVariable>(V)){
return new SlotCalculator(GV->getParent(), true);
- } else if (const Function *Func = dyn_cast<const Function>(V)) {
+ } else if (const Function *Func = dyn_cast<Function>(V)) {
return new SlotCalculator(Func, true);
}
return 0;
// As a heuristic, don't insert pointer to primitive types, because
// they are used too often to have a single useful name.
//
- const Type *Ty = cast<const Type>(I->second);
+ const Type *Ty = cast<Type>(I->second);
if (!isa<PointerType>(Ty) ||
!cast<PointerType>(Ty)->getElementType()->isPrimitiveType())
TypeNames.insert(std::make_pair(Ty, "%"+I->first));
std::string Result;
switch (Ty->getPrimitiveID()) {
case Type::FunctionTyID: {
- const FunctionType *FTy = cast<const FunctionType>(Ty);
+ const FunctionType *FTy = cast<FunctionType>(Ty);
Result = calcTypeName(FTy->getReturnType(), TypeStack, TypeNames) + " (";
for (FunctionType::ParamTypes::const_iterator
I = FTy->getParamTypes().begin(),
break;
}
case Type::StructTyID: {
- const StructType *STy = cast<const StructType>(Ty);
+ const StructType *STy = cast<StructType>(Ty);
Result = "{ ";
for (StructType::ElementTypes::const_iterator
I = STy->getElementTypes().begin(),
break;
}
case Type::PointerTyID:
- Result = calcTypeName(cast<const PointerType>(Ty)->getElementType(),
+ Result = calcTypeName(cast<PointerType>(Ty)->getElementType(),
TypeStack, TypeNames) + "*";
break;
case Type::ArrayTyID: {
- const ArrayType *ATy = cast<const ArrayType>(Ty);
+ const ArrayType *ATy = cast<ArrayType>(Ty);
Result = "[" + utostr(ATy->getNumElements()) + " x ";
Result += calcTypeName(ATy->getElementType(), TypeStack, TypeNames) + "]";
break;
if (PrintName && V->hasName()) {
Out << "%" << V->getName();
} else {
- if (const Constant *CV = dyn_cast<const Constant>(V)) {
+ if (const Constant *CV = dyn_cast<Constant>(V)) {
WriteConstantInt(Out, CV, PrintName, TypeTable, Table);
} else {
int Slot;
if (Table) {
Slot = Table->getValSlot(V);
} else {
- if (const Type *Ty = dyn_cast<const Type>(V)) {
+ if (const Type *Ty = dyn_cast<Type>(V)) {
Out << Ty->getDescription();
return;
}
for (; I != End; ++I) {
const Value *V = I->second;
- if (const Constant *CPV = dyn_cast<const Constant>(V)) {
+ if (const Constant *CPV = dyn_cast<Constant>(V)) {
printConstant(CPV);
- } else if (const Type *Ty = dyn_cast<const Type>(V)) {
+ } else if (const Type *Ty = dyn_cast<Type>(V)) {
Out << "\t%" << I->first << " = type ";
// Make sure we print out at least one level of the type structure, so
switch (V->getValueType()) {
case Value::ConstantVal:
case Value::ArgumentVal: AW->writeOperand(V, true, true); break;
- case Value::TypeVal: AW->write(cast<const Type>(V)); break;
+ case Value::TypeVal: AW->write(cast<Type>(V)); break;
case Value::InstructionVal: AW->write(cast<Instruction>(V)); break;
case Value::BasicBlockVal: AW->write(cast<BasicBlock>(V)); break;
case Value::FunctionVal: AW->write(cast<Function>(V)); break;
}
// If it's a type, make sure that all subtypes of the type are included...
- if (const Type *TheTy = dyn_cast<const Type>(D)) {
+ if (const Type *TheTy = dyn_cast<Type>(D)) {
// Insert the current type before any subtypes. This is important because
// recursive types elements are inserted in a bottom up order. Changing
if (TyPlane != end()) {
VarMap &TyP = TyPlane->second;
for (VarMap::iterator I = TyP.begin(), E = TyP.end(); I != E; ++I) {
- const Type *Ty = cast<const Type>(I->second);
+ const Type *Ty = cast<Type>(I->second);
if (Ty->isAbstract()) // If abstract, drop the reference...
cast<DerivedType>(Ty)->removeAbstractTypeUser(this);
}
// If we are removing an abstract type, remove the symbol table from it's use
// list...
if (Ty == Type::TypeTy) {
- const Type *T = cast<const Type>(Result);
+ const Type *T = cast<Type>(Result);
if (T->isAbstract()) {
#if DEBUG_ABSTYPE
std::cerr << "Removing abs type from symtab" << T->getDescription()<<"\n";
// If we are adding an abstract type, add the symbol table to it's use list.
if (VTy == Type::TypeTy) {
- const Type *T = cast<const Type>(V);
+ const Type *T = cast<Type>(V);
if (T->isAbstract()) {
cast<DerivedType>(T)->addAbstractTypeUser(this);
#if DEBUG_ABSTYPE
#if DEBUG_ABSTYPE
std::cerr << "Added type " << NewType->getDescription() << "\n";
#endif
- cast<const DerivedType>(NewType)->addAbstractTypeUser(this);
+ cast<DerivedType>(NewType)->addAbstractTypeUser(this);
}
}
}
switch (Ty->getPrimitiveID()) {
case Type::FunctionTyID: {
- const FunctionType *MTy = cast<const FunctionType>(Ty);
+ const FunctionType *MTy = cast<FunctionType>(Ty);
Result = getTypeProps(MTy->getReturnType(), TypeStack,
isAbstract, isRecursive)+" (";
for (FunctionType::ParamTypes::const_iterator
break;
}
case Type::StructTyID: {
- const StructType *STy = cast<const StructType>(Ty);
+ const StructType *STy = cast<StructType>(Ty);
Result = "{ ";
for (StructType::ElementTypes::const_iterator
I = STy->getElementTypes().begin(),
break;
}
case Type::PointerTyID: {
- const PointerType *PTy = cast<const PointerType>(Ty);
+ const PointerType *PTy = cast<PointerType>(Ty);
Result = getTypeProps(PTy->getElementType(), TypeStack,
isAbstract, isRecursive) + " *";
break;
}
case Type::ArrayTyID: {
- const ArrayType *ATy = cast<const ArrayType>(Ty);
+ const ArrayType *ATy = cast<ArrayType>(Ty);
unsigned NumElements = ATy->getNumElements();
Result = "[";
Result += utostr(NumElements) + " x ";
// algorithm is the fact that arraytypes have sizes that differentiates types,
// and that method types can be varargs or not. Consider this now.
if (const ArrayType *ATy = dyn_cast<ArrayType>(Ty)) {
- if (ATy->getNumElements() != cast<const ArrayType>(Ty2)->getNumElements())
+ if (ATy->getNumElements() != cast<ArrayType>(Ty2)->getNumElements())
return false;
} else if (const FunctionType *MTy = dyn_cast<FunctionType>(Ty)) {
- if (MTy->isVarArg() != cast<const FunctionType>(Ty2)->isVarArg())
+ if (MTy->isVarArg() != cast<FunctionType>(Ty2)->isVarArg())
return false;
}