llvm::Type::isSingleValueType. Currently these two functions have
the same behavior, but soon isFirstClassType will return true for
struct and array types.
Clang may some day want to use of isFirstClassType for some of
these some day as an optimization, but it'll require some
consideration.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51446
91177308-0d34-0410-b5e6-
96231b3b80d8
} else if (Target.useGlobalsForAutomaticVariables()) {
DeclPtr = GenerateStaticBlockVarDecl(D, true, ".arg.");
} else {
- // A fixed sized first class variable becomes an alloca in the entry block.
+ // A fixed sized single-value variable becomes an alloca in the entry block.
const llvm::Type *LTy = ConvertType(Ty);
- if (LTy->isFirstClassType()) {
+ if (LTy->isSingleValueType()) {
// TODO: Alignment
DeclPtr = new llvm::AllocaInst(LTy, 0, std::string(D.getName())+".addr",
AllocaInsertPt);
cast<llvm::PointerType>(Ptr->getType())->getElementType();
// Simple scalar l-value.
- if (EltTy->isFirstClassType()) {
+ if (EltTy->isSingleValueType()) {
llvm::Value *V = Builder.CreateLoad(Ptr, "tmp");
// Bool can have different representation in memory than in registers.
const llvm::Type *EType = AType->getElementType();
for (/*Do not initialize i*/; i < NumArrayElements; ++i) {
llvm::Value *NextVal = Builder.CreateStructGEP(DestPtr, i, ".array");
- if (EType->isFirstClassType())
+ if (EType->isSingleValueType())
Builder.CreateStore(llvm::Constant::getNullValue(EType), NextVal);
else
EmitAggregateClear(NextVal, QType);
// If the first output operand is not a memory dest, we'll
// make it the return value.
if (i == 0 && !(Info & TargetInfo::CI_AllowsMemory) &&
- DestValueType->isFirstClassType()) {
+ DestValueType->isSingleValueType()) {
ResultAddr = Dest.getAddress();
ResultType = DestValueType;
Constraints += "=" + OutputConstraint;
llvm::Value *Arg;
if ((Info & TargetInfo::CI_AllowsRegister) ||
!(Info & TargetInfo::CI_AllowsMemory)) {
- if (ConvertType(InputExpr->getType())->isFirstClassType()) {
+ if (ConvertType(InputExpr->getType())->isSingleValueType()) {
Arg = EmitScalarExpr(InputExpr);
} else {
- assert(0 && "FIXME: Implement passing non first class types as inputs");
+ assert(0 && "FIXME: Implement passing multiple-value types as inputs");
}
} else {
LValue Dest = EmitLValue(InputExpr);
if ((Info & TargetInfo::CI_AllowsRegister) ||
!(Info & TargetInfo::CI_AllowsMemory)) {
- if (ConvertType(InputExpr->getType())->isFirstClassType()) {
+ if (ConvertType(InputExpr->getType())->isSingleValueType()) {
Arg = EmitScalarExpr(InputExpr);
} else {
- assert(0 && "FIXME: Implement passing non first class types as inputs");
+ assert(0 && "FIXME: Implement passing multiple-value types as inputs");
}
} else {
LValue Dest = EmitLValue(InputExpr);
std::vector<const llvm::Type*> ArgTys;
// Struct return passes the struct byref.
- if (!ResultType->isFirstClassType() && ResultType != llvm::Type::VoidTy) {
+ if (!ResultType->isSingleValueType() && ResultType != llvm::Type::VoidTy) {
ArgTys.push_back(llvm::PointerType::get(ResultType,
FP.getResultType().getAddressSpace()));
ResultType = llvm::Type::VoidTy;
std::vector<const llvm::Type*> &ArgTys) {
for (unsigned i = 0, e = FTP.getNumArgs(); i != e; ++i) {
const llvm::Type *Ty = ConvertTypeRecursive(FTP.getArgType(i));
- if (Ty->isFirstClassType())
+ if (Ty->isSingleValueType())
ArgTys.push_back(Ty);
else
// byval arguments are always on the stack, which is addr space #0.