[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp

Chris Lattner lattner at cs.uiuc.edu
Sat Oct 16 11:13:58 PDT 2004



Changes in directory llvm/lib/Target/PowerPC:

PPC32ISelSimple.cpp updated: 1.91 -> 1.92
---
Log message:

ADd support for undef and unreachable


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

Index: llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp
diff -u llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp:1.91 llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp:1.92
--- llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp:1.91	Thu Oct 14 19:50:19 2004
+++ llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp	Sat Oct 16 13:13:47 2004
@@ -237,9 +237,10 @@
     // Visitation methods for various instructions.  These methods simply emit
     // fixed PowerPC code for each instruction.
 
-    // Control flow operators
+    // Control flow operators.
     void visitReturnInst(ReturnInst &RI);
     void visitBranchInst(BranchInst &BI);
+    void visitUnreachableInst(UnreachableInst &UI) {}
 
     struct ValueRecord {
       Value *Val;
@@ -575,6 +576,10 @@
 void PPC32ISel::copyConstantToRegister(MachineBasicBlock *MBB,
                                        MachineBasicBlock::iterator IP,
                                        Constant *C, unsigned R) {
+  if (isa<UndefValue>(C)) {
+    BuildMI(*MBB, IP, PPC::IMPLICIT_DEF, 0, R);
+    return;
+  }
   if (C->getType()->isIntegral()) {
     unsigned Class = getClassB(C->getType());
 
@@ -2117,9 +2122,8 @@
   
   // xor X, -1 -> not X
   if (Opcode == 4) {
-    ConstantSInt *CSI = dyn_cast<ConstantSInt>(Op1);
-    ConstantUInt *CUI = dyn_cast<ConstantUInt>(Op1);
-    if ((CSI && CSI->isAllOnesValue()) || (CUI && CUI->isAllOnesValue())) {
+    ConstantInt *CI = dyn_cast<ConstantSInt>(Op1);
+    if (CI && CI->isAllOnesValue()) {
       BuildMI(*MBB, IP, PPC::NOR, 2, DestReg).addReg(Op0Reg).addReg(Op0Reg);
       return;
     }






More information about the llvm-commits mailing list