summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2008-12-05 05:31:14 +0000
committerDan Gohman <gohman@apple.com>2008-12-05 05:31:14 +0000
commit9bb56443a169535a1e41948cc2da1fe3081448c0 (patch)
tree2ca7dbd87183d8dae51d9516d1901ca46fe6e05f /llvm/lib/CodeGen
parentc1dee225d036b3c7b745da41cd4dfaa02c9afc0a (diff)
downloadbcm5719-llvm-9bb56443a169535a1e41948cc2da1fe3081448c0.tar.gz
bcm5719-llvm-9bb56443a169535a1e41948cc2da1fe3081448c0.zip
Teach StackSlotColoring to update MachineMemOperands when
changing the stack slots on an instruction, to keep them consistent with the actual memory addresses. llvm-svn: 60584
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/StackSlotColoring.cpp23
1 files changed, 20 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/StackSlotColoring.cpp b/llvm/lib/CodeGen/StackSlotColoring.cpp
index bc062835fb3..fdd2336e78d 100644
--- a/llvm/lib/CodeGen/StackSlotColoring.cpp
+++ b/llvm/lib/CodeGen/StackSlotColoring.cpp
@@ -15,6 +15,7 @@
#include "llvm/CodeGen/Passes.h"
#include "llvm/CodeGen/LiveStackAnalysis.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
+#include "llvm/CodeGen/PseudoSourceValue.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Debug.h"
@@ -225,10 +226,26 @@ bool StackSlotColoring::ColorSlots(MachineFunction &MF) {
int FI = MO.getIndex();
if (FI < 0)
continue;
- FI = SlotMapping[FI];
- if (FI == -1)
+ int NewFI = SlotMapping[FI];
+ if (NewFI == -1)
continue;
- MO.setIndex(FI);
+ MO.setIndex(NewFI);
+
+ // Update the MachineMemOperand for the new memory location.
+ // FIXME: We need a better method of managing these too.
+ SmallVector<MachineMemOperand, 2> MMOs(MI.memoperands_begin(),
+ MI.memoperands_end());
+ MI.clearMemOperands(MF);
+ const Value *OldSV = PseudoSourceValue::getFixedStack(FI);
+ for (unsigned i = 0, e = MMOs.size(); i != e; ++i) {
+ if (MMOs[i].getValue() == OldSV) {
+ MachineMemOperand MMO(PseudoSourceValue::getFixedStack(NewFI),
+ MMOs[i].getFlags(), MMOs[i].getOffset(),
+ MMOs[i].getSize(), MMOs[i].getAlignment());
+ MI.addMemOperand(MF, MMO);
+ } else
+ MI.addMemOperand(MF, MMOs[i]);
+ }
}
}
}
OpenPOWER on IntegriCloud