Add a public method called getAddressSpace() to the GlobalAddressSDNode.
authorSanjiv Gupta <sanjiv.gupta@microchip.com>
Wed, 29 Apr 2009 04:43:24 +0000 (04:43 +0000)
committerSanjiv Gupta <sanjiv.gupta@microchip.com>
Wed, 29 Apr 2009 04:43:24 +0000 (04:43 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70366 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/SelectionDAGNodes.h
lib/CodeGen/SelectionDAG/SelectionDAG.cpp
lib/Target/PIC16/PIC16ISelLowering.cpp

index 3fb34c1590b1786d3d33c86c5625b4ab3e8fd681..34d877a0271abb1a035798986dae9e9a972cbafc 100644 (file)
@@ -1814,6 +1814,8 @@ public:
 
   GlobalValue *getGlobal() const { return TheGlobal; }
   int64_t getOffset() const { return Offset; }
+  // Return the address space this GlobalAddress belongs to.
+  unsigned getAddressSpace() const;
 
   static bool classof(const GlobalAddressSDNode *) { return true; }
   static bool classof(const SDNode *N) {
index 7c9a00135a1a187c8273558ef172c7c03596a448..1c85e9d743e2dba9b1774ec17cfd53fdc637a7f7 100644 (file)
@@ -5649,6 +5649,13 @@ void SDNode::dumpr() const {
   DumpNodesr(errs(), this, 0, 0, once);
 }
 
+
+// getAddressSpace - Return the address space this GlobalAddress belongs to.
+unsigned GlobalAddressSDNode::getAddressSpace() const {
+  return getGlobal()->getType()->getAddressSpace();
+}
+
+
 const Type *ConstantPoolSDNode::getType() const {
   if (isMachineConstantPoolEntry())
     return Val.MachineCPVal->getType();
index 87753f98c55d2ca4bc21ffd90a62b2c2a6034041..b817d05c05f51f85b3df6a8fff351e12220faebb 100644 (file)
@@ -483,9 +483,8 @@ bool PIC16TargetLowering::isRomAddress(const SDValue &Op) {
   // It is BUILD_PAIR((PIC16Lo TGA), (PIC16Hi TGA)) and Op is BUILD_PAIR
   SDValue TGA = Op.getOperand(0).getOperand(0);
   GlobalAddressSDNode *GSDN = dyn_cast<GlobalAddressSDNode>(TGA);
-  int AddrSpace = GSDN->getGlobal()->getType()->getAddressSpace();
 
-  if (AddrSpace == PIC16ISD::ROM_SPACE)
+  if (GSDN->getAddressSpace() == PIC16ISD::ROM_SPACE)
     return true;
 
   // Any other address space return it false