[llvm-commits] [SignlessTypes] CVS: llvm/tools/llvm2cpp/CppWriter.cpp
Reid Spencer
reid at x10sys.com
Wed Oct 18 20:58:57 PDT 2006
Changes in directory llvm/tools/llvm2cpp:
CppWriter.cpp updated: 1.16 -> 1.16.2.1
---
Log message:
For PR950: http://llvm.org/PR950 :
This commit (on SignlessTypes branch) provides the first Iteration for
moving LLVM away from Signed types. This patch removes the ConstantSInt
and ConstantUInt classes from Type.h and makes all necessary changes in
LLVM to compensate.
---
Diffs of the changes: (+5 -6)
CppWriter.cpp | 11 +++++------
1 files changed, 5 insertions(+), 6 deletions(-)
Index: llvm/tools/llvm2cpp/CppWriter.cpp
diff -u llvm/tools/llvm2cpp/CppWriter.cpp:1.16 llvm/tools/llvm2cpp/CppWriter.cpp:1.16.2.1
--- llvm/tools/llvm2cpp/CppWriter.cpp:1.16 Thu Sep 28 18:24:48 2006
+++ llvm/tools/llvm2cpp/CppWriter.cpp Wed Oct 18 22:57:56 2006
@@ -678,12 +678,11 @@
if (const ConstantBool *CB = dyn_cast<ConstantBool>(CV)) {
Out << "ConstantBool* " << constName << " = ConstantBool::get("
<< (CB->getValue() ? "true" : "false") << ");";
- } else if (const ConstantSInt *CI = dyn_cast<ConstantSInt>(CV)) {
- Out << "ConstantSInt* " << constName << " = ConstantSInt::get("
- << typeName << ", " << CI->getValue() << ");";
- } else if (const ConstantUInt *CI = dyn_cast<ConstantUInt>(CV)) {
- Out << "ConstantUInt* " << constName << " = ConstantUInt::get("
- << typeName << ", " << CI->getValue() << ");";
+ } else if (const ConstantInt *CI = dyn_cast<ConstantInt>(CV)) {
+ Out << "ConstantInt* " << constName << " = ConstantInt::get("
+ << typeName << ", "
+ << (CV->getType()->isSigned() ? CI->getSExtValue() : CI->getZExtValue())
+ << ");";
} else if (isa<ConstantAggregateZero>(CV)) {
Out << "ConstantAggregateZero* " << constName
<< " = ConstantAggregateZero::get(" << typeName << ");";
More information about the llvm-commits
mailing list