public:
enum Kind {
Default,
+
+ Direct, /// Pass the argument directly using the normal
+ /// converted LLVM type.
+
StructRet, /// Only valid for return values. The return value
/// should be passed through a pointer to a caller
/// allocated location passed as an implicit first
static ABIArgInfo getDefault() {
return ABIArgInfo(Default);
}
+ static ABIArgInfo getDirect() {
+ return ABIArgInfo(Direct);
+ }
static ABIArgInfo getStructRet() {
return ABIArgInfo(StructRet);
}
Kind getKind() const { return TheKind; }
bool isDefault() const { return TheKind == Default; }
+ bool isDirect() const { return TheKind == Direct; }
bool isStructRet() const { return TheKind == StructRet; }
bool isIgnore() const { return TheKind == Ignore; }
bool isCoerce() const { return TheKind == Coerce; }
}
break;
+ case ABIArgInfo::Direct:
+ ResultType = ConvertType(RetTy);
+ break;
+
case ABIArgInfo::StructRet: {
ResultType = llvm::Type::VoidTy;
const llvm::Type *STy = ConvertType(RetTy);
break;
case ABIArgInfo::Default:
+ case ABIArgInfo::Direct:
ArgTys.push_back(Ty);
break;
const ABIArgInfo &RetAI = FI.getReturnInfo();
switch (RetAI.getKind()) {
case ABIArgInfo::Default:
+ case ABIArgInfo::Direct:
if (RetTy->isPromotableIntegerType()) {
if (RetTy->isSignedIntegerType()) {
RetAttrs |= llvm::Attribute::SExt;
break;
case ABIArgInfo::Default:
+ case ABIArgInfo::Direct:
if (ParamType->isPromotableIntegerType()) {
if (ParamType->isSignedIntegerType()) {
Attributes |= llvm::Attribute::SExt;
switch (ArgI.getKind()) {
case ABIArgInfo::ByVal:
- case ABIArgInfo::Default: {
+ case ABIArgInfo::Default:
+ case ABIArgInfo::Direct: {
assert(AI != Fn->arg_end() && "Argument mismatch!");
llvm::Value* V = AI;
if (!getContext().typesAreCompatible(Ty, Arg->getType())) {
break;
case ABIArgInfo::Default:
+ case ABIArgInfo::Direct:
RV = Builder.CreateLoad(ReturnValue);
break;
break;
case ABIArgInfo::Default:
+ case ABIArgInfo::Direct:
case ABIArgInfo::Ignore:
case ABIArgInfo::Coerce:
break;
switch (ArgInfo.getKind()) {
case ABIArgInfo::ByVal: // Default is byval
case ABIArgInfo::Default:
+ case ABIArgInfo::Direct:
if (RV.isScalar()) {
Args.push_back(RV.getScalarVal());
} else if (RV.isComplex()) {
case ABIArgInfo::Default:
return RValue::get(RetTy->isVoidType() ? 0 : CI);
+
+ case ABIArgInfo::Direct:
+ assert((!RetTy->isAnyComplexType() &&
+ CodeGenFunction::hasAggregateLLVMType(RetTy)) &&
+ "FIXME: Implemented return for non-scalar direct types.");
+ return RValue::get(CI);
case ABIArgInfo::Ignore:
if (RetTy->isVoidType())