diff options
author | Juergen Ributzka <juergen@apple.com> | 2014-08-14 19:56:28 +0000 |
---|---|---|
committer | Juergen Ributzka <juergen@apple.com> | 2014-08-14 19:56:28 +0000 |
commit | 790bacf232d0ec3cee7c41fef4702b7f90862269 (patch) | |
tree | 579ad6ffa3206e8cbacf5bf8f4abb7f19f22f660 /llvm/lib/CodeGen | |
parent | 53e6a5d60c7be3ce3fc261e08b3926bb12a27663 (diff) | |
download | bcm5719-llvm-790bacf232d0ec3cee7c41fef4702b7f90862269.tar.gz bcm5719-llvm-790bacf232d0ec3cee7c41fef4702b7f90862269.zip |
Revert several FastISel commits to track down a buildbot error.
This reverts:
r215595 "[FastISel][X86] Add large code model support for materializing floating-point constants."
r215594 "[FastISel][X86] Use XOR to materialize the "0" value."
r215593 "[FastISel][X86] Emit more efficient instructions for integer constant materialization."
r215591 "[FastISel][AArch64] Make use of the zero register when possible."
r215588 "[FastISel] Let the target decide first if it wants to materialize a constant."
r215582 "[FastISel][AArch64] Cleanup constant materialization code. NFCI."
llvm-svn: 215673
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/FastISel.cpp | 36 |
1 files changed, 15 insertions, 21 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp index 93a366a8546..1c2cee29a79 100644 --- a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp @@ -198,24 +198,29 @@ unsigned FastISel::getRegForValue(const Value *V) { return Reg; } -unsigned FastISel::MaterializeConstant(const Value *V, MVT VT) { +/// materializeRegForValue - Helper for getRegForValue. 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()); - } else if (isa<AllocaInst>(V)) + } else if (isa<AllocaInst>(V)) { Reg = TargetMaterializeAlloca(cast<AllocaInst>(V)); - else if (isa<ConstantPointerNull>(V)) + } else if (isa<ConstantPointerNull>(V)) { // Translate this as an integer zero so that it can be // local-CSE'd with actual integer zeros. Reg = getRegForValue(Constant::getNullValue(DL.getIntPtrType(V->getContext()))); - else if (const ConstantFP *CF = dyn_cast<ConstantFP>(V)) { - if (CF->isNullValue()) + } else if (const ConstantFP *CF = dyn_cast<ConstantFP>(V)) { + if (CF->isNullValue()) { Reg = TargetMaterializeFloatZero(CF); - else + } else { // Try to emit the constant directly. Reg = FastEmit_f(VT, VT, ISD::ConstantFP, CF); + } if (!Reg) { // Try to emit the constant by using an integer constant with a cast. @@ -248,26 +253,15 @@ unsigned FastISel::MaterializeConstant(const Value *V, MVT VT) { BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc, TII.get(TargetOpcode::IMPLICIT_DEF), Reg); } - return Reg; -} -/// materializeRegForValue - Helper for getRegForValue. 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; - // Give the target-specific code a try first. - if (isa<Constant>(V)) + // If target-independent code couldn't handle the value, give target-specific + // code a try. + if (!Reg && isa<Constant>(V)) Reg = TargetMaterializeConstant(cast<Constant>(V)); - // If target-specific code couldn't or didn't want to handle the value, then - // give target-independent code a try. - if (!Reg) - Reg = MaterializeConstant(V, VT); - // Don't cache constant materializations in the general ValueMap. // To do so would require tracking what uses they dominate. - if (Reg) { + if (Reg != 0) { LocalValueMap[V] = Reg; LastLocalValue = MRI.getVRegDef(Reg); } |