[llvm-commits] CVS: llvm/lib/CodeGen/AsmPrinter.cpp MachineDebugInfo.cpp

Zhou Sheng zhousheng00 at gmail.com
Thu Jan 11 04:25:07 PST 2007



Changes in directory llvm/lib/CodeGen:

AsmPrinter.cpp updated: 1.129 -> 1.130
MachineDebugInfo.cpp updated: 1.66 -> 1.67
---
Log message:

For PR1043: http://llvm.org/PR1043 :
Merge ConstantIntegral and ConstantBool into ConstantInt.
Remove ConstantIntegral and ConstantBool from LLVM.


---
Diffs of the changes:  (+8 -8)

 AsmPrinter.cpp       |   10 +++++-----
 MachineDebugInfo.cpp |    6 +++---
 2 files changed, 8 insertions(+), 8 deletions(-)


Index: llvm/lib/CodeGen/AsmPrinter.cpp
diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.129 llvm/lib/CodeGen/AsmPrinter.cpp:1.130
--- llvm/lib/CodeGen/AsmPrinter.cpp:1.129	Sat Dec 30 23:55:36 2006
+++ llvm/lib/CodeGen/AsmPrinter.cpp	Thu Jan 11 06:24:14 2007
@@ -388,11 +388,11 @@
 void AsmPrinter::EmitConstantValueOnly(const Constant *CV) {
   if (CV->isNullValue() || isa<UndefValue>(CV))
     O << "0";
-  else if (const ConstantBool *CB = dyn_cast<ConstantBool>(CV)) {
-    assert(CB->getValue());
-    O << "1";
-  } else if (const ConstantInt *CI = dyn_cast<ConstantInt>(CV)) {
-    O << CI->getSExtValue();
+  else if (const ConstantInt *CI = dyn_cast<ConstantInt>(CV)) {
+    if (CI->getType() == Type::BoolTy) {
+      assert(CI->getBoolValue());
+      O << "1";
+    } else O << CI->getSExtValue();
   } else if (const GlobalValue *GV = dyn_cast<GlobalValue>(CV)) {
     // This is a constant address for a global variable or function. Use the
     // name of the variable or function as the address value, possibly


Index: llvm/lib/CodeGen/MachineDebugInfo.cpp
diff -u llvm/lib/CodeGen/MachineDebugInfo.cpp:1.66 llvm/lib/CodeGen/MachineDebugInfo.cpp:1.67
--- llvm/lib/CodeGen/MachineDebugInfo.cpp:1.66	Wed Jan  3 07:46:20 2007
+++ llvm/lib/CodeGen/MachineDebugInfo.cpp	Thu Jan 11 06:24:14 2007
@@ -211,7 +211,7 @@
   }
   virtual void Apply(bool &Field) {
     Constant *C = CI->getOperand(I++);
-    Field = cast<ConstantBool>(C)->getValue();
+    Field = cast<ConstantInt>(C)->getBoolValue();
   }
   virtual void Apply(std::string &Field) {
     Constant *C = CI->getOperand(I++);
@@ -276,7 +276,7 @@
     Elements.push_back(ConstantInt::get(Type::Int64Ty, uint64_t(Field)));
   }
   virtual void Apply(bool &Field) {
-    Elements.push_back(ConstantBool::get(Field));
+    Elements.push_back(ConstantInt::get(Field));
   }
   virtual void Apply(std::string &Field) {
       Elements.push_back(SR.getString(Field));
@@ -426,7 +426,7 @@
   }
   virtual void Apply(bool &Field) {
     Constant *C = CI->getOperand(I++);
-    IsValid = IsValid && isa<ConstantBool>(C);
+    IsValid = IsValid && isa<ConstantInt>(C) && C->getType() == Type::BoolTy;
   }
   virtual void Apply(std::string &Field) {
     Constant *C = CI->getOperand(I++);






More information about the llvm-commits mailing list