diff options
author | Andrew Lenharth <andrewl@lenharth.org> | 2008-02-19 19:47:54 +0000 |
---|---|---|
committer | Andrew Lenharth <andrewl@lenharth.org> | 2008-02-19 19:47:54 +0000 |
commit | 4aa9e208faca61a22493d4d731aa4f9cbe900399 (patch) | |
tree | 3248b13d772d01bd2057d9cc825538e114986bf6 /llvm/lib/Target/CBackend/CBackend.cpp | |
parent | e2162c65498bd9e0403222da199737fb6acad610 (diff) | |
download | bcm5719-llvm-4aa9e208faca61a22493d4d731aa4f9cbe900399.tar.gz bcm5719-llvm-4aa9e208faca61a22493d4d731aa4f9cbe900399.zip |
fix some byval problems in the cbe. Closes PR2065
llvm-svn: 47337
Diffstat (limited to 'llvm/lib/Target/CBackend/CBackend.cpp')
-rw-r--r-- | llvm/lib/Target/CBackend/CBackend.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/llvm/lib/Target/CBackend/CBackend.cpp b/llvm/lib/Target/CBackend/CBackend.cpp index 334f6fe54f9..d01c2ab74af 100644 --- a/llvm/lib/Target/CBackend/CBackend.cpp +++ b/llvm/lib/Target/CBackend/CBackend.cpp @@ -1198,12 +1198,12 @@ void CWriter::writeOperandRaw(Value *Operand) { } void CWriter::writeOperand(Value *Operand) { - if (isa<GlobalVariable>(Operand) || isDirectAlloca(Operand)) + if (isa<GlobalVariable>(Operand) || isDirectAlloca(Operand) || ByValParams.count(Operand)) Out << "(&"; // Global variables are referenced as their addresses by llvm writeOperandInternal(Operand); - if (isa<GlobalVariable>(Operand) || isDirectAlloca(Operand)) + if (isa<GlobalVariable>(Operand) || isDirectAlloca(Operand) || ByValParams.count(Operand)) Out << ')'; } @@ -2723,13 +2723,11 @@ void CWriter::visitCallInst(CallInst &I) { // Check if the argument is expected to be passed by value. bool isOutByVal = PAL && PAL->paramHasAttr(ArgNo+1, ParamAttr::ByVal); // Check if this argument itself is passed in by reference. - bool isInByVal = ByValParams.count(*AI); - if (isOutByVal && !isInByVal) + //bool isInByVal = ByValParams.count(*AI); + if (isOutByVal) Out << "*("; - else if (!isOutByVal && isInByVal) - Out << "&("; writeOperand(*AI); - if (isOutByVal ^ isInByVal) + if (isOutByVal) Out << ")"; PrintedArg = true; } |