[llvm-commits] [dragonegg] r121123 - /dragonegg/trunk/llvm-convert.cpp
Duncan Sands
baldrick at free.fr
Tue Dec 7 01:02:21 PST 2010
Author: baldrick
Date: Tue Dec 7 03:02:21 2010
New Revision: 121123
URL: http://llvm.org/viewvc/llvm-project?rev=121123&view=rev
Log:
Port commit 121122 (foad) from llvm-gcc:
PR5207: Change APInt methods trunc(), sext(), zext(), sextOrTrunc() and
zextOrTrunc(), and APSInt methods extend(), extOrTrunc() and new method
trunc(), to be const and to return a new value instead of modifying the
object in place.
Modified:
dragonegg/trunk/llvm-convert.cpp
Modified: dragonegg/trunk/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-convert.cpp?rev=121123&r1=121122&r2=121123&view=diff
==============================================================================
--- dragonegg/trunk/llvm-convert.cpp (original)
+++ dragonegg/trunk/llvm-convert.cpp Tue Dec 7 03:02:21 2010
@@ -8428,7 +8428,7 @@
ValC = 0;
} else if (!BYTES_BIG_ENDIAN) {
// Little endian, take bits from the bottom of the field value.
- ValForPrevField.trunc(BitsInPreviousField);
+ ValForPrevField = ValForPrevField.trunc(BitsInPreviousField);
APInt Tmp = ValC->getValue();
Tmp = Tmp.lshr(BitsInPreviousField);
Tmp = Tmp.trunc(ValBitSize-BitsInPreviousField);
@@ -8436,7 +8436,7 @@
} else {
// Big endian, take bits from the top of the field value.
ValForPrevField = ValForPrevField.lshr(ValBitSize-BitsInPreviousField);
- ValForPrevField.trunc(BitsInPreviousField);
+ ValForPrevField = ValForPrevField.trunc(BitsInPreviousField);
APInt Tmp = ValC->getValue();
Tmp = Tmp.trunc(ValBitSize-BitsInPreviousField);
@@ -8445,7 +8445,7 @@
// Okay, we're going to insert ValForPrevField into the previous i8, extend
// it and shift into place.
- ValForPrevField.zext(8);
+ ValForPrevField = ValForPrevField.zext(8);
if (!BYTES_BIG_ENDIAN) {
ValForPrevField = ValForPrevField.shl(8-BitsInPreviousField);
} else {
@@ -8473,23 +8473,19 @@
if (Val.getBitWidth() > 8) {
if (!BYTES_BIG_ENDIAN) {
// Little endian lays out low bits first.
- APInt Tmp = Val;
- Tmp.trunc(8);
+ APInt Tmp = Val.trunc(8);
ValToAppend = ConstantInt::get(Context, Tmp);
Val = Val.lshr(8);
} else {
// Big endian lays out high bits first.
- APInt Tmp = Val;
- Tmp = Tmp.lshr(Tmp.getBitWidth()-8);
- Tmp.trunc(8);
+ APInt Tmp = Val.lshr(Tmp.getBitWidth()-8).trunc(8);
ValToAppend = ConstantInt::get(Context, Tmp);
}
} else if (Val.getBitWidth() == 8) {
ValToAppend = ConstantInt::get(Context, Val);
} else {
- APInt Tmp = Val;
- Tmp.zext(8);
+ APInt Tmp = Val.zext(8);
if (BYTES_BIG_ENDIAN)
Tmp = Tmp << 8-Val.getBitWidth();
@@ -8501,7 +8497,7 @@
if (Val.getBitWidth() <= 8)
break;
- Val.trunc(Val.getBitWidth()-8);
+ Val = Val.trunc(Val.getBitWidth()-8);
}
}
More information about the llvm-commits
mailing list