Add a public method called getAddressSpace() to the GlobalAddressSDNode.

llvm-svn: 70366
This commit is contained in:
Sanjiv Gupta 2009-04-29 04:43:24 +00:00
parent e525dc3c66
commit ccd30945f9
3 changed files with 10 additions and 2 deletions

View File

@ -1814,6 +1814,8 @@ public:
GlobalValue *getGlobal() const { return TheGlobal; } GlobalValue *getGlobal() const { return TheGlobal; }
int64_t getOffset() const { return Offset; } 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 GlobalAddressSDNode *) { return true; }
static bool classof(const SDNode *N) { static bool classof(const SDNode *N) {

View File

@ -5649,6 +5649,13 @@ void SDNode::dumpr() const {
DumpNodesr(errs(), this, 0, 0, once); 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 { const Type *ConstantPoolSDNode::getType() const {
if (isMachineConstantPoolEntry()) if (isMachineConstantPoolEntry())
return Val.MachineCPVal->getType(); return Val.MachineCPVal->getType();

View File

@ -483,9 +483,8 @@ bool PIC16TargetLowering::isRomAddress(const SDValue &Op) {
// It is BUILD_PAIR((PIC16Lo TGA), (PIC16Hi TGA)) and Op is BUILD_PAIR // It is BUILD_PAIR((PIC16Lo TGA), (PIC16Hi TGA)) and Op is BUILD_PAIR
SDValue TGA = Op.getOperand(0).getOperand(0); SDValue TGA = Op.getOperand(0).getOperand(0);
GlobalAddressSDNode *GSDN = dyn_cast<GlobalAddressSDNode>(TGA); 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; return true;
// Any other address space return it false // Any other address space return it false