summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorStepan Dyatkovskiy <stpworld@narod.ru>2012-06-01 10:06:14 +0000
committerStepan Dyatkovskiy <stpworld@narod.ru>2012-06-01 10:06:14 +0000
commitbd7303b7f747f3299b3ea30228702c61e7f416d1 (patch)
treee7271edb38bbba3d9e39bda880c9a921815b8028 /llvm/lib
parentcad2e4e6c2b3b8baa14dba3093f113d345f37a96 (diff)
downloadbcm5719-llvm-bd7303b7f747f3299b3ea30228702c61e7f416d1.tar.gz
bcm5719-llvm-bd7303b7f747f3299b3ea30228702c61e7f416d1.zip
PR1255: case ranges.
IntItem cleanup. IntItemBase, IntItemConstantIntImp and IntItem merged into IntItem. All arithmetic operators was propogated from APInt. Also added comparison operators <,>,<=,>=. Currently you will find set of macros that propogates operators from APInt to IntItem in the beginning of IntegerSubset. Note that THESE MACROS WILL REMOVED after all passes will case-ranges compatible. Also note that these macros much smaller pain that something like this: if (V->getValue().ugt(AnotherV->getValue()) { ... } These changes made IntItem full featured integer object. It allows to make IntegerSubset class generic (move out all ConstantInt references inside and add unit-tests) in next commits. llvm-svn: 157810
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/ExecutionEngine/Interpreter/Execution.cpp4
-rw-r--r--llvm/lib/VMCore/Verifier.cpp4
2 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp b/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
index d54010195d0..d4b6ed00033 100644
--- a/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
+++ b/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
@@ -655,8 +655,8 @@ void Interpreter::visitSwitchInst(SwitchInst &I) {
for (unsigned n = 0, en = Case.getNumItems(); n != en; ++n) {
IntegersSubset::Range r = Case.getItem(n);
// FIXME: Currently work with ConstantInt based numbers.
- const ConstantInt *LowCI = r.Low.getImplementation();
- const ConstantInt *HighCI = r.High.getImplementation();
+ const ConstantInt *LowCI = r.Low.toConstantInt();
+ const ConstantInt *HighCI = r.High.toConstantInt();
GenericValue Low = getOperandValue(const_cast<ConstantInt*>(LowCI), SF);
GenericValue High = getOperandValue(const_cast<ConstantInt*>(HighCI), SF);
if (executeICMP_ULE(Low, CondVal, ElTy).IntVal != 0 &&
diff --git a/llvm/lib/VMCore/Verifier.cpp b/llvm/lib/VMCore/Verifier.cpp
index e093c52f99f..7afe342899f 100644
--- a/llvm/lib/VMCore/Verifier.cpp
+++ b/llvm/lib/VMCore/Verifier.cpp
@@ -813,9 +813,9 @@ void Verifier::visitSwitchInst(SwitchInst &SI) {
IntegersSubset CaseRanges = i.getCaseValueEx();
for (unsigned ri = 0, rie = CaseRanges.getNumItems(); ri < rie; ++ri) {
IntegersSubset::Range r = CaseRanges.getItem(ri);
- Assert1(r.Low->getBitWidth() == IntTy->getBitWidth(),
+ Assert1(((const APInt&)r.Low).getBitWidth() == IntTy->getBitWidth(),
"Switch constants must all be same type as switch value!", &SI);
- Assert1(r.High->getBitWidth() == IntTy->getBitWidth(),
+ Assert1(((const APInt&)r.High).getBitWidth() == IntTy->getBitWidth(),
"Switch constants must all be same type as switch value!", &SI);
Mapping.add(r);
RangeSetMap[r] = i.getCaseIndex();
OpenPOWER on IntegriCloud