aboutsummaryrefslogtreecommitdiff
path: root/lib/Target/CBackend/CBackend.cpp
diff options
context:
space:
mode:
authorZhou Sheng <zhousheng00@gmail.com>2007-01-11 12:24:14 +0000
committerZhou Sheng <zhousheng00@gmail.com>2007-01-11 12:24:14 +0000
commit6b6b6ef1677fa71b1072c2911b4c1f9524a558c9 (patch)
tree480ecf010ac5facd1bc29ab57441253691bb42d6 /lib/Target/CBackend/CBackend.cpp
parent057809ac1c78c3456e8f1481330fa2bcd2b85029 (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/Target/CBackend/CBackend.cpp')
-rw-r--r--lib/Target/CBackend/CBackend.cpp27
1 files changed, 13 insertions, 14 deletions
diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp
index 55fade5362..9517134c88 100644
--- a/lib/Target/CBackend/CBackend.cpp
+++ b/lib/Target/CBackend/CBackend.cpp
@@ -826,22 +826,21 @@ void CWriter::printConstant(Constant *CPV) {
return;
}
- if (ConstantBool *CB = dyn_cast<ConstantBool>(CPV)) {
- Out << (CB->getValue() ? '1' : '0') ;
- return;
- }
-
if (ConstantInt *CI = dyn_cast<ConstantInt>(CPV)) {
const Type* Ty = CI->getType();
- Out << "((";
- printPrimitiveType(Out, Ty, false) << ')';
- if (CI->isMinValue(true))
- Out << CI->getZExtValue() << 'u';
- else
- Out << CI->getSExtValue();
- if (Ty->getPrimitiveSizeInBits() > 32)
- Out << "ll";
- Out << ')';
+ if (Ty == Type::BoolTy)
+ Out << (CI->getBoolValue() ? '1' : '0') ;
+ else {
+ Out << "((";
+ printPrimitiveType(Out, Ty, false) << ')';
+ if (CI->isMinValue(true))
+ Out << CI->getZExtValue() << 'u';
+ else
+ Out << CI->getSExtValue();
+ if (Ty->getPrimitiveSizeInBits() > 32)
+ Out << "ll";
+ Out << ')';
+ }
return;
}