[llvm-commits] [dragonegg] r134058 - in /dragonegg/trunk/src: Convert.cpp Trees.cpp
Duncan Sands
baldrick at free.fr
Wed Jun 29 00:00:45 PDT 2011
Author: baldrick
Date: Wed Jun 29 02:00:45 2011
New Revision: 134058
URL: http://llvm.org/viewvc/llvm-project?rev=134058&view=rev
Log:
Simplify EmitIntegerRegisterConstant using getIntegerValue which
turns an INTEGER_CST into an APInt.
Modified:
dragonegg/trunk/src/Convert.cpp
dragonegg/trunk/src/Trees.cpp
Modified: dragonegg/trunk/src/Convert.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Convert.cpp?rev=134058&r1=134057&r2=134058&view=diff
==============================================================================
--- dragonegg/trunk/src/Convert.cpp (original)
+++ dragonegg/trunk/src/Convert.cpp Wed Jun 29 02:00:45 2011
@@ -6201,23 +6201,7 @@
/// EmitIntegerRegisterConstant - Turn the given INTEGER_CST into an LLVM
/// constant of the corresponding register type.
Constant *TreeToLLVM::EmitIntegerRegisterConstant(tree reg) {
- unsigned Precision = TYPE_PRECISION(TREE_TYPE(reg));
-
- ConstantInt *CI;
- if (HOST_BITS_PER_WIDE_INT < integerPartWidth) {
- assert(2 * HOST_BITS_PER_WIDE_INT <= integerPartWidth &&
- "Unsupported host integer precision!");
- unsigned ShiftAmt = HOST_BITS_PER_WIDE_INT;
- integerPart Val = (integerPart)(unsigned HOST_WIDE_INT)TREE_INT_CST_LOW(reg)
- + ((integerPart)(unsigned HOST_WIDE_INT)TREE_INT_CST_HIGH(reg) << ShiftAmt);
- CI = ConstantInt::get(Context, APInt(Precision, Val));
- } else {
- assert(HOST_BITS_PER_WIDE_INT == integerPartWidth &&
- "The engines cannae' take it captain!");
- integerPart Parts[] = { TREE_INT_CST_LOW(reg), TREE_INT_CST_HIGH(reg) };
- CI = ConstantInt::get(Context, APInt(Precision, 2, Parts));
- }
-
+ ConstantInt *CI = ConstantInt::get(Context, getIntegerValue(reg));
// The destination can be a pointer, integer or floating point type so we need
// a generalized cast here
const Type *Ty = getRegType(TREE_TYPE(reg));
Modified: dragonegg/trunk/src/Trees.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Trees.cpp?rev=134058&r1=134057&r2=134058&view=diff
==============================================================================
--- dragonegg/trunk/src/Trees.cpp (original)
+++ dragonegg/trunk/src/Trees.cpp Wed Jun 29 02:00:45 2011
@@ -152,7 +152,8 @@
assert(integerPartWidth == 2 * HOST_BITS_PER_WIDE_INT &&
"Unsupported host integer width!");
unsigned ShiftAmt = HOST_BITS_PER_WIDE_INT;
- integerPart Part = integerPart(val.low) + (integerPart(val.high) << ShiftAmt);
+ integerPart Part = integerPart((unsigned HOST_WIDE_INT)val.low) +
+ (integerPart((unsigned HOST_WIDE_INT)val.high) << ShiftAmt);
return APInt(NumBits, Part);
}
More information about the llvm-commits
mailing list