summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/CBackend/CBackend.cpp
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
commite43b6054b1d91cdf3942e243dc1c654f7a782e8b (patch)
treeda7a16188add194009457dd0300176c3d79ef5fb /llvm/lib/Target/CBackend/CBackend.cpp
parente7b462b329dda0d7518e2a1e0e0d18e82bba218c (diff)
downloadbcm5719-llvm-e43b6054b1d91cdf3942e243dc1c654f7a782e8b.tar.gz
bcm5719-llvm-e43b6054b1d91cdf3942e243dc1c654f7a782e8b.zip
Temporarily backing out r47337. It breaks a number of CBE tests.
llvm-svn: 47385
Diffstat (limited to 'llvm/lib/Target/CBackend/CBackend.cpp')
-rw-r--r--llvm/lib/Target/CBackend/CBackend.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/llvm/lib/Target/CBackend/CBackend.cpp b/llvm/lib/Target/CBackend/CBackend.cpp
index 305c8de3740..91ca97e9ef5 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) || 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;
}
OpenPOWER on IntegriCloud