aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Lenharth <andrewl@lenharth.org>2008-02-19 19:47:54 +0000
committerAndrew Lenharth <andrewl@lenharth.org>2008-02-19 19:47:54 +0000
commit86532db5d7b1a8e03d9677ee3d15daca1a59b6f2 (patch)
treec994a1d97af5a2605373035e6583e7d22f21f8ee
parentf27dfcb210fec571d79bc881f5463e0b405707c0 (diff)
downloadexternal_llvm-86532db5d7b1a8e03d9677ee3d15daca1a59b6f2.zip
external_llvm-86532db5d7b1a8e03d9677ee3d15daca1a59b6f2.tar.gz
external_llvm-86532db5d7b1a8e03d9677ee3d15daca1a59b6f2.tar.bz2
fix some byval problems in the cbe. Closes PR2065
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47337 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Target/CBackend/CBackend.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp
index 334f6fe..d01c2ab 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))
+ 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;
}