void AssemblyWriter::writeOperand(const Value *Operand, bool PrintType,
bool PrintName) {
- assert(Operand != 0 && "Illegal Operand");
- if (PrintType) { Out << ' '; printType(Operand->getType()); }
- WriteAsOperandInternal(Out, Operand, PrintName, TypeNames, &Machine);
+ if (Operand != 0) {
+ if (PrintType) { Out << ' '; printType(Operand->getType()); }
+ WriteAsOperandInternal(Out, Operand, PrintName, TypeNames, &Machine);
+ } else {
+ Out << "<null operand!>";
+ }
}
for (unsigned i = 0, e = I.getNumOperands(); i != e; ++i) {
// Check to make sure that the "address of" an intrinsic function is never
// taken.
+ Assert1(I.getOperand(i) != 0, "Instruction has null operand!", &I);
if (Function *F = dyn_cast<Function>(I.getOperand(i))) {
Assert1(!F->isIntrinsic() || (i == 0 && isa<CallInst>(I)),
"Cannot take the address of an intrinsic!", &I);