[llvm-branch-commits] [llvm-branch] r86401 - in /llvm/branches/Apple/Leela/lib/Target/ARM: Thumb1InstrInfo.cpp Thumb2InstrInfo.cpp

Evan Cheng evan.cheng at apple.com
Sat Nov 7 11:42:37 PST 2009


Author: evancheng
Date: Sat Nov  7 13:42:37 2009
New Revision: 86401

URL: http://llvm.org/viewvc/llvm-project?rev=86401&view=rev
Log:
Merged r86400.

Modified:
    llvm/branches/Apple/Leela/lib/Target/ARM/Thumb1InstrInfo.cpp
    llvm/branches/Apple/Leela/lib/Target/ARM/Thumb2InstrInfo.cpp

Modified: llvm/branches/Apple/Leela/lib/Target/ARM/Thumb1InstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/Target/ARM/Thumb1InstrInfo.cpp?rev=86401&r1=86400&r2=86401&view=diff

==============================================================================
--- llvm/branches/Apple/Leela/lib/Target/ARM/Thumb1InstrInfo.cpp (original)
+++ llvm/branches/Apple/Leela/lib/Target/ARM/Thumb1InstrInfo.cpp Sat Nov  7 13:42:37 2009
@@ -16,6 +16,8 @@
 #include "ARMConstantPoolValue.h"
 #include "ARMGenInstrInfo.inc"
 #include "ARMMachineFunctionInfo.h"
+#include "llvm/Constants.h"
+#include "llvm/Function.h"
 #include "llvm/GlobalValue.h"
 #include "llvm/CodeGen/MachineConstantPool.h"
 #include "llvm/CodeGen/MachineFrameInfo.h"
@@ -290,10 +292,19 @@
            "Expecting a machine constantpool entry!");
     ARMConstantPoolValue *ACPV =
       static_cast<ARMConstantPoolValue*>(MCPE.Val.MachineCPVal);
-    assert(ACPV->isGlobalValue() && "Expecting a GV!");
     unsigned PCLabelId = AFI->createConstPoolEntryUId();
-    ARMConstantPoolValue *NewCPV =
-      new ARMConstantPoolValue(ACPV->getGV(), PCLabelId, ARMCP::CPValue, 4);
+    ARMConstantPoolValue *NewCPV = 0;
+    if (ACPV->isGlobalValue())
+      NewCPV = new ARMConstantPoolValue(ACPV->getGV(), PCLabelId,
+                                        ARMCP::CPValue, 4);
+    else if (ACPV->isExtSymbol())
+      NewCPV = new ARMConstantPoolValue(MF.getFunction()->getContext(),
+                                        ACPV->getSymbol(), PCLabelId, 4);
+    else if (ACPV->isBlockAddress())
+      NewCPV = new ARMConstantPoolValue(ACPV->getBlockAddress(), PCLabelId,
+                                        ARMCP::CPBlockAddress, 4);
+    else
+      llvm_unreachable("Unexpected ARM constantpool value type!!");
     CPI = MCP->getConstantPoolIndex(NewCPV, MCPE.getAlignment());
     MachineInstrBuilder MIB = BuildMI(MBB, I, Orig->getDebugLoc(), get(Opcode),
                                       DestReg)

Modified: llvm/branches/Apple/Leela/lib/Target/ARM/Thumb2InstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/Target/ARM/Thumb2InstrInfo.cpp?rev=86401&r1=86400&r2=86401&view=diff

==============================================================================
--- llvm/branches/Apple/Leela/lib/Target/ARM/Thumb2InstrInfo.cpp (original)
+++ llvm/branches/Apple/Leela/lib/Target/ARM/Thumb2InstrInfo.cpp Sat Nov  7 13:42:37 2009
@@ -17,6 +17,8 @@
 #include "ARMAddressingModes.h"
 #include "ARMGenInstrInfo.inc"
 #include "ARMMachineFunctionInfo.h"
+#include "llvm/Constants.h"
+#include "llvm/Function.h"
 #include "llvm/GlobalValue.h"
 #include "llvm/CodeGen/MachineConstantPool.h"
 #include "llvm/CodeGen/MachineFrameInfo.h"
@@ -158,10 +160,19 @@
            "Expecting a machine constantpool entry!");
     ARMConstantPoolValue *ACPV =
       static_cast<ARMConstantPoolValue*>(MCPE.Val.MachineCPVal);
-    assert(ACPV->isGlobalValue() && "Expecting a GV!");
     unsigned PCLabelId = AFI->createConstPoolEntryUId();
-    ARMConstantPoolValue *NewCPV =
-      new ARMConstantPoolValue(ACPV->getGV(), PCLabelId, ARMCP::CPValue, 4);
+    ARMConstantPoolValue *NewCPV = 0;
+    if (ACPV->isGlobalValue())
+      NewCPV = new ARMConstantPoolValue(ACPV->getGV(), PCLabelId,
+                                        ARMCP::CPValue, 4);
+    else if (ACPV->isExtSymbol())
+      NewCPV = new ARMConstantPoolValue(MF.getFunction()->getContext(),
+                                        ACPV->getSymbol(), PCLabelId, 4);
+    else if (ACPV->isBlockAddress())
+      NewCPV = new ARMConstantPoolValue(ACPV->getBlockAddress(), PCLabelId,
+                                        ARMCP::CPBlockAddress, 4);
+    else
+      llvm_unreachable("Unexpected ARM constantpool value type!!");
     CPI = MCP->getConstantPoolIndex(NewCPV, MCPE.getAlignment());
     MachineInstrBuilder MIB = BuildMI(MBB, I, Orig->getDebugLoc(), get(Opcode),
                                       DestReg)





More information about the llvm-branch-commits mailing list