Add PseudoSourceValue::mayAlias. It returns true if the object can ever alias any...
authorEvan Cheng <evan.cheng@apple.com>
Sun, 1 Nov 2009 23:50:04 +0000 (23:50 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Sun, 1 Nov 2009 23:50:04 +0000 (23:50 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85762 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/PseudoSourceValue.h
lib/CodeGen/PseudoSourceValue.cpp

index 7a9122d89f9dd7fee5f842b76536df6272344780..26392f59bd79b5676d0f0af507f375aca8b998cb 100644 (file)
@@ -43,6 +43,10 @@ namespace llvm {
     /// PseudoSourceValue may also be pointed to by an LLVM IR Value.
     virtual bool isAliased(const MachineFrameInfo *) const;
 
+    /// mayAlias - Return true if the memory pointed to by this
+    /// PseudoSourceValue can ever alias a LLVM IR Value.
+    virtual bool mayAlias(const MachineFrameInfo *) const;
+
     /// classof - Methods for support type inquiry through isa, cast, and
     /// dyn_cast:
     ///
index 1875cc78f58ae617f177061fe6e26f40e3dc5251..5507646878cbc34cc9f740eeb799b23d17e23604 100644 (file)
@@ -64,6 +64,8 @@ namespace {
 
     virtual bool isAliased(const MachineFrameInfo *MFI) const;
 
+    virtual bool mayAlias(const MachineFrameInfo *) const;
+
     virtual void printCustom(raw_ostream &OS) const {
       OS << "FixedStack" << FI;
     }
@@ -100,6 +102,14 @@ bool PseudoSourceValue::isAliased(const MachineFrameInfo *MFI) const {
   return true;
 }
 
+bool PseudoSourceValue::mayAlias(const MachineFrameInfo *MFI) const {
+  if (this == getGOT() ||
+      this == getConstantPool() ||
+      this == getJumpTable())
+    return false;
+  return true;
+}
+
 bool FixedStackPseudoSourceValue::isConstant(const MachineFrameInfo *MFI) const{
   return MFI && MFI->isImmutableObjectIndex(FI);
 }
@@ -113,3 +123,10 @@ bool FixedStackPseudoSourceValue::isAliased(const MachineFrameInfo *MFI) const {
   // Spill slots should not alias others.
   return !MFI->isFixedObjectIndex(FI) && !MFI->isSpillSlotObjectIndex(FI);
 }
+
+bool FixedStackPseudoSourceValue::mayAlias(const MachineFrameInfo *MFI) const {
+  if (!MFI)
+    return true;
+  // Spill slots will not alias any LLVM IR value.
+  return !MFI->isSpillSlotObjectIndex(FI);
+}