Tell TargetLoweringOpt whether it is running before

or after legalize.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45321 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2007-12-22 20:56:36 +00:00
parent 1a3048bb8e
commit b16f55f3c8
2 changed files with 4 additions and 2 deletions

View File

@ -557,10 +557,12 @@ public:
/// that want to combine /// that want to combine
struct TargetLoweringOpt { struct TargetLoweringOpt {
SelectionDAG &DAG; SelectionDAG &DAG;
bool AfterLegalize;
SDOperand Old; SDOperand Old;
SDOperand New; SDOperand New;
explicit TargetLoweringOpt(SelectionDAG &InDAG) : DAG(InDAG) {} explicit TargetLoweringOpt(SelectionDAG &InDAG, bool afterLegalize)
: DAG(InDAG), AfterLegalize(afterLegalize) {}
bool CombineTo(SDOperand O, SDOperand N) { bool CombineTo(SDOperand O, SDOperand N) {
Old = O; Old = O;

View File

@ -141,7 +141,7 @@ namespace {
/// it can be simplified or if things it uses can be simplified by bit /// it can be simplified or if things it uses can be simplified by bit
/// propagation. If so, return true. /// propagation. If so, return true.
bool SimplifyDemandedBits(SDOperand Op, uint64_t Demanded = ~0ULL) { bool SimplifyDemandedBits(SDOperand Op, uint64_t Demanded = ~0ULL) {
TargetLowering::TargetLoweringOpt TLO(DAG); TargetLowering::TargetLoweringOpt TLO(DAG, AfterLegalize);
uint64_t KnownZero, KnownOne; uint64_t KnownZero, KnownOne;
Demanded &= MVT::getIntVTBitMask(Op.getValueType()); Demanded &= MVT::getIntVTBitMask(Op.getValueType());
if (!TLI.SimplifyDemandedBits(Op, Demanded, KnownZero, KnownOne, TLO)) if (!TLI.SimplifyDemandedBits(Op, Demanded, KnownZero, KnownOne, TLO))