Rename ExplicitByvalRewrite to IndirectByvalRewrite

This commit is contained in:
Martin Kinkelin 2018-05-27 00:57:26 +02:00
parent 8faab8b684
commit 5d8b581025
4 changed files with 10 additions and 10 deletions

View file

@ -173,22 +173,22 @@ struct IntegerRewrite : ABIRewrite {
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
/** /**
* Implements explicit ByVal semantics defined like this: * Implements indirect high-level-by-value semantics defined like this:
* Instead of passing a copy of the original argument directly to the callee, * Instead of passing a copy of the original argument directly to the callee,
* the caller makes a bitcopy on its stack first and then passes a pointer to * the caller makes a bitcopy on its stack first and then passes a pointer to
* that copy to the callee. * that copy to the callee.
* The pointer is passed as regular parameter and hence occupies either a * The pointer is passed as regular parameter and hence occupies either a
* register or a function parameters stack slot. * register or a function parameters stack slot.
* *
* This differs from LLVM's ByVal attribute for pointer parameters. * This differs from LLVM's byval attribute for pointer parameters.
* The ByVal attribute instructs LLVM to pass the pointed-to argument directly * The byval attribute instructs LLVM to bitcopy the IR argument pointee onto
* as a copy on the function parameters stack. In this case, there's no need to * the callee parameters stack. The callee's IR parameter is an implicit pointer
* pass an explicit pointer; the address is implicit. * to that private copy.
*/ */
struct ExplicitByvalRewrite : ABIRewrite { struct IndirectByvalRewrite : ABIRewrite {
const unsigned minAlignment; const unsigned minAlignment;
explicit ExplicitByvalRewrite(unsigned minAlignment = 16) explicit IndirectByvalRewrite(unsigned minAlignment = 16)
: minAlignment(minAlignment) {} : minAlignment(minAlignment) {}
LLValue *put(DValue *v, bool) override { LLValue *put(DValue *v, bool) override {

View file

@ -34,7 +34,7 @@
struct Win64TargetABI : TargetABI { struct Win64TargetABI : TargetABI {
private: private:
const bool isMSVC; const bool isMSVC;
ExplicitByvalRewrite byvalRewrite; IndirectByvalRewrite byvalRewrite;
IntegerRewrite integerRewrite; IntegerRewrite integerRewrite;
bool isX87(Type *t) const { bool isX87(Type *t) const {

View file

@ -1066,7 +1066,7 @@ void ldc::DIBuilder::EmitLocalVariable(llvm::Value *ll, VarDeclaration *vd,
const bool isRefOrOut = vd->isRef() || vd->isOut(); // incl. special-ref vars const bool isRefOrOut = vd->isRef() || vd->isOut(); // incl. special-ref vars
// For MSVC x64 targets, declare params rewritten by ExplicitByvalRewrite as // For MSVC x64 targets, declare params rewritten by IndirectByvalRewrite as
// DI references, as if they were ref parameters. // DI references, as if they were ref parameters.
const bool isPassedExplicitlyByval = const bool isPassedExplicitlyByval =
isTargetMSVCx64 && !isRefOrOut && isaArgument(ll) && addr.empty(); isTargetMSVCx64 && !isRefOrOut && isaArgument(ll) && addr.empty();

View file

@ -388,7 +388,7 @@ static void DtoCreateNestedContextType(FuncDeclaration *fd) {
} else if (vd->isParameter() && (vd->storage_class & STClazy)) { } else if (vd->isParameter() && (vd->storage_class & STClazy)) {
// The LL type is a delegate (LL struct). // The LL type is a delegate (LL struct).
// Depending on the used TargetABI, the LL parameter is either a struct or // Depending on the used TargetABI, the LL parameter is either a struct or
// a pointer to a struct (`byval` attribute, ExplicitByvalRewrite). // a pointer to a struct (`byval` attribute, IndirectByvalRewrite).
t = getIrParameter(vd)->value->getType(); t = getIrParameter(vd)->value->getType();
if (t->isPointerTy()) if (t->isPointerTy())
t = t->getPointerElementType(); t = t->getPointerElementType();