mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Switch all of the indirect-call code in IRGen to FunctionPointer.
To make this stick, I've disallowed direct use of that overload of CreateCall. I've left the Constant overloads available, but eventually we might want to consider fixing those, too, just to get all of this code out of the business of manually remembering to pass around attributes and calling conventions. The test changes reflect the fact that we weren't really setting attributes consistently at all, in this case on value witnesses.
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "Callee.h"
|
||||
#include "ConstantBuilder.h"
|
||||
#include "Explosion.h"
|
||||
#include "GenClass.h"
|
||||
@@ -72,7 +73,7 @@ getAccessorForComputedComponent(IRGenModule &IGM,
|
||||
if (requirements.empty()) {
|
||||
return accessorFn;
|
||||
}
|
||||
|
||||
|
||||
auto accessorFnTy = accessorFn->getType()->getPointerElementType();
|
||||
|
||||
// Otherwise, we need a thunk to unmarshal the generic environment from the
|
||||
@@ -142,9 +143,9 @@ getAccessorForComputedComponent(IRGenModule &IGM,
|
||||
forwardingSubs,
|
||||
&witnessMetadata,
|
||||
forwardedArgs);
|
||||
auto call = IGF.Builder.CreateCall(accessorFn, forwardedArgs.claimAll());
|
||||
if (whichAccessor == Getter)
|
||||
call->addAttribute(1, llvm::Attribute::StructRet);
|
||||
auto fnPtr = FunctionPointer::forDirect(IGM, accessorFn,
|
||||
accessor->getLoweredFunctionType());
|
||||
IGF.Builder.CreateCall(fnPtr, forwardedArgs.claimAll());
|
||||
|
||||
IGF.Builder.CreateRetVoid();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user