Mercurial > projects > ldc
diff gen/functions.cpp @ 739:1ae94fb1dbbd
Fix accidental double-inreg caused by shared TupleType. Enabled inreg by default.
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Thu, 30 Oct 2008 10:16:37 +0100 |
parents | 6de2ed4f0abe |
children | 2d7bcfa68128 |
line wrap: on
line diff
--- a/gen/functions.cpp Thu Oct 30 10:15:42 2008 +0100 +++ b/gen/functions.cpp Thu Oct 30 10:16:37 2008 +0100 @@ -203,16 +203,18 @@ // pass first param in EAX if it fits, is not floating point and is not a 3 byte struct. // FIXME: struct are not passed in EAX yet + int n_inreg = f->reverseParams ? n - 1 : 0; + Argument* arg = Argument::getNth(f->parameters, n_inreg); + // if there is a implicit context parameter, pass it in EAX if (usesthis || usesnest) { f->thisAttrs |= llvm::Attribute::InReg; + assert((!arg || (arg->llvmAttrs & llvm::Attribute::InReg) == 0) && "can't have two inreg args!"); } // otherwise check the first formal parameter else { - int inreg = f->reverseParams ? n - 1 : 0; - Argument* arg = Argument::getNth(f->parameters, inreg); Type* t = arg->type->toBasetype(); // 32bit ints, pointers, classes, static arrays and AAs @@ -223,6 +225,7 @@ (t->size() <= PTRSIZE)) { arg->llvmAttrs |= llvm::Attribute::InReg; + assert((f->thisAttrs & llvm::Attribute::InReg) == 0 && "can't have two inreg args!"); } } }