summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2008-09-09 01:26:59 +0000
committerEvan Cheng <evan.cheng@apple.com>2008-09-09 01:26:59 +0000
commit1e97901388d9a5d5f7b66a07af63ee3a19f903e0 (patch)
tree79b2c1e7ee55b6c090e213531cdef2aee22ec441 /llvm/lib/CodeGen
parentf080225490f700e627b6b01aba5b67270711d99e (diff)
downloadbcm5719-llvm-1e97901388d9a5d5f7b66a07af63ee3a19f903e0.tar.gz
bcm5719-llvm-1e97901388d9a5d5f7b66a07af63ee3a19f903e0.zip
Fix a constant lowering bug. Now we can do load and store instructions with funky getelementptr embedded in the address operand.
llvm-svn: 55975
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/FastISel.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
index 58467b8e0ea..33f4591b66a 100644
--- a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
@@ -40,6 +40,9 @@ unsigned FastISel::getRegForValue(Value *V) {
// Don't cache constant materializations. To do so would require
// tracking what uses they dominate.
Reg = FastEmit_i(VT, VT, ISD::Constant, CI->getZExtValue());
+ } else if (isa<GlobalValue>(V)) {
+ return TargetMaterializeConstant(dyn_cast<Constant>(V),
+ MBB->getParent()->getConstantPool());
} else if (isa<ConstantPointerNull>(V)) {
Reg = FastEmit_i(VT, VT, ISD::Constant, 0);
} else if (ConstantFP *CF = dyn_cast<ConstantFP>(V)) {
@@ -85,6 +88,16 @@ unsigned FastISel::getRegForValue(Value *V) {
return Reg;
}
+unsigned FastISel::lookUpRegForValue(Value *V) {
+ // Look up the value to see if we already have a register for it. We
+ // cache values defined by Instructions across blocks, and other values
+ // only locally. This is because Instructions already have the SSA
+ // def-dominatess-use requirement enforced.
+ if (ValueMap.count(V))
+ return ValueMap[V];
+ return LocalValueMap[V];
+}
+
/// UpdateValueMap - Update the value map to include the new mapping for this
/// instruction, or insert an extra copy to get the result in a previous
/// determined register.
OpenPOWER on IntegriCloud