aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2008-02-20 18:32:05 +0000
committerEvan Cheng <evan.cheng@apple.com>2008-02-20 18:32:05 +0000
commit5144ed1e35fe55f2e5171e359ee733583a21f641 (patch)
treefacbb70bbba64c6a316b2cb926d8905e5d9ec1b9
parentf83b1f63ddf27aaba791393940f37709ebbda33b (diff)
downloadexternal_llvm-5144ed1e35fe55f2e5171e359ee733583a21f641.zip
external_llvm-5144ed1e35fe55f2e5171e359ee733583a21f641.tar.gz
external_llvm-5144ed1e35fe55f2e5171e359ee733583a21f641.tar.bz2
Temporarily backing out r47337. It breaks a number of CBE tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47385 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Target/CBackend/CBackend.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp
index 305c8de..91ca97e 100644
--- a/lib/Target/CBackend/CBackend.cpp
+++ b/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) || ByValParams.count(Operand))
+ if (isa<GlobalVariable>(Operand) || isDirectAlloca(Operand))
Out << "(&"; // Global variables are referenced as their addresses by llvm
writeOperandInternal(Operand);
- if (isa<GlobalVariable>(Operand) || isDirectAlloca(Operand) || ByValParams.count(Operand))
+ if (isa<GlobalVariable>(Operand) || isDirectAlloca(Operand))
Out << ')';
}
@@ -2723,11 +2723,13 @@ 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)
+ bool isInByVal = ByValParams.count(*AI);
+ if (isOutByVal && !isInByVal)
Out << "*(";
+ else if (!isOutByVal && isInByVal)
+ Out << "&(";
writeOperand(*AI);
- if (isOutByVal)
+ if (isOutByVal ^ isInByVal)
Out << ")";
PrintedArg = true;
}