[LLVMdev] is structtyp a firstclass typ?

Jianzhou Zhao jianzhou at seas.upenn.edu
Wed Mar 17 14:58:35 PDT 2010


Hi LLVM,

In lib/VMCare/Verifier.cpp::visitInstruction, we have such code

1287   // Check that the return value of the instruction is either
void or a legal
1288   // value type.
1289   Assert1(I.getType() == Type::getVoidTy(I.getContext()) ||
1290           I.getType()->isFirstClassType()
1291           || ((isa<CallInst>(I) || isa<InvokeInst>(I))
1292               && isa<StructType>(I.getType())),
1293           "Instruction returns a non-scalar type!", &I);

line 1291-1292 allows the return type to be struct typ.
But are these two lines redundant? The isFirstClassType()
only disallows function types, void, and opaque:

236   inline bool isFirstClassType() const {
237     // There are more first-class kinds than non-first-class kinds, so a
238     // negative test is simpler than a positive one.
239     return ID != FunctionTyID && ID != VoidTyID && ID != OpaqueTyID;
240   }

Is struct typ also a first class type?

-- 
Jianzhou



More information about the llvm-dev mailing list