diff options
author | Dan Gohman <gohman@apple.com> | 2010-05-03 23:36:34 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-05-03 23:36:34 +0000 |
commit | 626b5d8e0ce71b2db461beb6af453bc46a018a48 (patch) | |
tree | 5d5b03431e15f09ef82b7ea9d9f541373363ebb6 /llvm/lib/CodeGen/SelectionDAG | |
parent | 1bd7a944600083821afe54ca9366863d40f6990a (diff) | |
download | bcm5719-llvm-626b5d8e0ce71b2db461beb6af453bc46a018a48.tar.gz bcm5719-llvm-626b5d8e0ce71b2db461beb6af453bc46a018a48.zip |
Factor out FastISel's code for materializing constants and other values
in registers into a separate function to de-couple it from the
top-down-specific logic in getRegForValue.
llvm-svn: 102975
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/FastISel.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp index 49bfbffa623..b4c38332691 100644 --- a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp @@ -84,6 +84,15 @@ unsigned FastISel::getRegForValue(const Value *V) { if (Reg != 0) return Reg; + return materializeRegForValue(V, VT); +} + +/// materializeRegForValue - Helper for getRegForVale. This function is +/// called when the value isn't already available in a register and must +/// be materialized with new instructions. +unsigned FastISel::materializeRegForValue(const Value *V, MVT VT) { + unsigned Reg = 0; + if (const ConstantInt *CI = dyn_cast<ConstantInt>(V)) { if (CI->getValue().getActiveBits() <= 64) Reg = FastEmit_i(VT, VT, ISD::Constant, CI->getZExtValue()); @@ -141,7 +150,7 @@ unsigned FastISel::lookUpRegForValue(const 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. + // def-dominates-use requirement enforced. if (ValueMap.count(V)) return ValueMap[V]; return LocalValueMap[V]; |