diff options
author | Zhou Sheng <zhousheng00@gmail.com> | 2007-01-11 12:24:14 +0000 |
---|---|---|
committer | Zhou Sheng <zhousheng00@gmail.com> | 2007-01-11 12:24:14 +0000 |
commit | 6b6b6ef1677fa71b1072c2911b4c1f9524a558c9 (patch) | |
tree | 480ecf010ac5facd1bc29ab57441253691bb42d6 /lib/CodeGen | |
parent | 057809ac1c78c3456e8f1481330fa2bcd2b85029 (diff) |
For PR1043:
Merge ConstantIntegral and ConstantBool into ConstantInt.
Remove ConstantIntegral and ConstantBool from LLVM.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33073 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r-- | lib/CodeGen/AsmPrinter.cpp | 10 | ||||
-rw-r--r-- | lib/CodeGen/MachineDebugInfo.cpp | 6 | ||||
-rw-r--r-- | lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | 24 |
3 files changed, 20 insertions, 20 deletions
diff --git a/lib/CodeGen/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter.cpp index 3f4bfd774d..339556b127 100644 --- a/lib/CodeGen/AsmPrinter.cpp +++ b/lib/CodeGen/AsmPrinter.cpp @@ -388,11 +388,11 @@ void AsmPrinter::EmitZeros(uint64_t NumZeros) const { void AsmPrinter::EmitConstantValueOnly(const Constant *CV) { if (CV->isNullValue() || isa<UndefValue>(CV)) O << "0"; - else if (const ConstantBool *CB = dyn_cast<ConstantBool>(CV)) { - assert(CB->getValue()); - O << "1"; - } else if (const ConstantInt *CI = dyn_cast<ConstantInt>(CV)) { - O << CI->getSExtValue(); + else if (const ConstantInt *CI = dyn_cast<ConstantInt>(CV)) { + if (CI->getType() == Type::BoolTy) { + assert(CI->getBoolValue()); + O << "1"; + } else O << CI->getSExtValue(); } else if (const GlobalValue *GV = dyn_cast<GlobalValue>(CV)) { // This is a constant address for a global variable or function. Use the // name of the variable or function as the address value, possibly diff --git a/lib/CodeGen/MachineDebugInfo.cpp b/lib/CodeGen/MachineDebugInfo.cpp index 041a88cdca..5d9de9ff34 100644 --- a/lib/CodeGen/MachineDebugInfo.cpp +++ b/lib/CodeGen/MachineDebugInfo.cpp @@ -211,7 +211,7 @@ public: } virtual void Apply(bool &Field) { Constant *C = CI->getOperand(I++); - Field = cast<ConstantBool>(C)->getValue(); + Field = cast<ConstantInt>(C)->getBoolValue(); } virtual void Apply(std::string &Field) { Constant *C = CI->getOperand(I++); @@ -276,7 +276,7 @@ public: Elements.push_back(ConstantInt::get(Type::Int64Ty, uint64_t(Field))); } virtual void Apply(bool &Field) { - Elements.push_back(ConstantBool::get(Field)); + Elements.push_back(ConstantInt::get(Field)); } virtual void Apply(std::string &Field) { Elements.push_back(SR.getString(Field)); @@ -426,7 +426,7 @@ public: } virtual void Apply(bool &Field) { Constant *C = CI->getOperand(I++); - IsValid = IsValid && isa<ConstantBool>(C); + IsValid = IsValid && isa<ConstantInt>(C) && C->getType() == Type::BoolTy; } virtual void Apply(std::string &Field) { Constant *C = CI->getOperand(I++); diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index ebfa50c9e8..7e6a75d772 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -649,7 +649,7 @@ SDOperand SelectionDAGLowering::getValue(const Value *V) { return N = DAG.getNode(ISD::VBUILD_VECTOR,MVT::Vector,&Ops[0],Ops.size()); } else { // Canonicalize all constant ints to be unsigned. - return N = DAG.getConstant(cast<ConstantIntegral>(C)->getZExtValue(),VT); + return N = DAG.getConstant(cast<ConstantInt>(C)->getZExtValue(),VT); } } @@ -904,7 +904,7 @@ void SelectionDAGLowering::FindMergedConditions(Value *Cond, } // Create a CaseBlock record representing this branch. - SelectionDAGISel::CaseBlock CB(ISD::SETEQ, Cond, ConstantBool::getTrue(), + SelectionDAGISel::CaseBlock CB(ISD::SETEQ, Cond, ConstantInt::getTrue(), TBB, FBB, CurBB); SwitchCases.push_back(CB); return; @@ -1043,7 +1043,7 @@ void SelectionDAGLowering::visitBr(BranchInst &I) { } // Create a CaseBlock record representing this branch. - SelectionDAGISel::CaseBlock CB(ISD::SETEQ, CondVal, ConstantBool::getTrue(), + SelectionDAGISel::CaseBlock CB(ISD::SETEQ, CondVal, ConstantInt::getTrue(), Succ0MBB, Succ1MBB, CurMBB); // Use visitSwitchCase to actually insert the fast branch sequence for this // cond branch. @@ -1058,9 +1058,9 @@ void SelectionDAGLowering::visitSwitchCase(SelectionDAGISel::CaseBlock &CB) { // Build the setcc now, fold "(X == true)" to X and "(X == false)" to !X to // handle common cases produced by branch lowering. - if (CB.CmpRHS == ConstantBool::getTrue() && CB.CC == ISD::SETEQ) + if (CB.CmpRHS == ConstantInt::getTrue() && CB.CC == ISD::SETEQ) Cond = CondLHS; - else if (CB.CmpRHS == ConstantBool::getFalse() && CB.CC == ISD::SETEQ) { + else if (CB.CmpRHS == ConstantInt::getFalse() && CB.CC == ISD::SETEQ) { SDOperand True = DAG.getConstant(1, CondLHS.getValueType()); Cond = DAG.getNode(ISD::XOR, CondLHS.getValueType(), CondLHS, True); } else @@ -1206,8 +1206,8 @@ void SelectionDAGLowering::visitSwitch(SwitchInst &I) { if ((TLI.isOperationLegal(ISD::BR_JT, MVT::Other) || TLI.isOperationLegal(ISD::BRIND, MVT::Other)) && Cases.size() > 5) { - uint64_t First =cast<ConstantIntegral>(Cases.front().first)->getZExtValue(); - uint64_t Last = cast<ConstantIntegral>(Cases.back().first)->getZExtValue(); + uint64_t First =cast<ConstantInt>(Cases.front().first)->getZExtValue(); + uint64_t Last = cast<ConstantInt>(Cases.back().first)->getZExtValue(); double Density = (double)Cases.size() / (double)((Last - First) + 1ULL); if (Density >= 0.3125) { @@ -1256,7 +1256,7 @@ void SelectionDAGLowering::visitSwitch(SwitchInst &I) { std::vector<MachineBasicBlock*> DestBBs; uint64_t TEI = First; for (CaseItr ii = Cases.begin(), ee = Cases.end(); ii != ee; ++TEI) - if (cast<ConstantIntegral>(ii->first)->getZExtValue() == TEI) { + if (cast<ConstantInt>(ii->first)->getZExtValue() == TEI) { DestBBs.push_back(ii->second); ++ii; } else { @@ -1338,8 +1338,8 @@ void SelectionDAGLowering::visitSwitch(SwitchInst &I) { // rather than creating a leaf node for it. if ((LHSR.second - LHSR.first) == 1 && LHSR.first->first == CR.GE && - cast<ConstantIntegral>(C)->getZExtValue() == - (cast<ConstantIntegral>(CR.GE)->getZExtValue() + 1ULL)) { + cast<ConstantInt>(C)->getZExtValue() == + (cast<ConstantInt>(CR.GE)->getZExtValue() + 1ULL)) { TrueBB = LHSR.first->second; } else { TrueBB = new MachineBasicBlock(LLVMBB); @@ -1352,8 +1352,8 @@ void SelectionDAGLowering::visitSwitch(SwitchInst &I) { // is CR.LT - 1, then we can branch directly to the target block for // the current Case Value, rather than emitting a RHS leaf node for it. if ((RHSR.second - RHSR.first) == 1 && CR.LT && - cast<ConstantIntegral>(RHSR.first->first)->getZExtValue() == - (cast<ConstantIntegral>(CR.LT)->getZExtValue() - 1ULL)) { + cast<ConstantInt>(RHSR.first->first)->getZExtValue() == + (cast<ConstantInt>(CR.LT)->getZExtValue() - 1ULL)) { FalseBB = RHSR.first->second; } else { FalseBB = new MachineBasicBlock(LLVMBB); |