[PM/AA] Extract the ModRef enums from the AliasAnalysis class in

preparation for de-coupling the AA implementations.

In order to do this, they had to become fake-scoped using the
traditional LLVM pattern of a leading initialism. These can't be actual
scoped enumerations because they're bitfields and thus inherently we use
them as integers.

I've also renamed the behavior enums that are specific to reasoning
about the mod/ref behavior of functions when called. This makes it more
clear that they have a very narrow domain of applicability.

I think there is a significantly cleaner API for all of this, but
I don't want to try to do really substantive changes for now, I just
want to refactor the things away from analysis groups so I'm preserving
the exact original design and just cleaning up the names, style, and
lifting out of the class.

Differential Revision: http://reviews.llvm.org/D10564

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242963 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chandler Carruth
2015-07-22 23:15:57 +00:00
parent 90b20e96a1
commit 52ab0bc417
32 changed files with 542 additions and 529 deletions

View File

@@ -27,11 +27,11 @@ protected:
// This is going to check that calling getModRefInfo without a location, and
// with a default location, first, doesn't crash, and second, gives the right
// answer.
void CheckModRef(Instruction *I, AliasAnalysis::ModRefResult Result) {
void CheckModRef(Instruction *I, ModRefInfo Result) {
static char ID;
class CheckModRefTestPass : public FunctionPass {
public:
CheckModRefTestPass(Instruction *I, AliasAnalysis::ModRefResult Result)
CheckModRefTestPass(Instruction *I, ModRefInfo Result)
: FunctionPass(ID), ExpectResult(Result), I(I) {}
static int initialize() {
PassInfo *PI = new PassInfo("CheckModRef testing pass", "", &ID,
@@ -51,7 +51,7 @@ protected:
EXPECT_EQ(AA.getModRefInfo(I), ExpectResult);
return false;
}
AliasAnalysis::ModRefResult ExpectResult;
ModRefInfo ExpectResult;
Instruction *I;
};
static int initialize = CheckModRefTestPass::initialize();
@@ -92,12 +92,12 @@ TEST_F(AliasAnalysisTest, getModRefInfo) {
ReturnInst::Create(C, nullptr, BB);
// Check basic results
CheckModRef(Store1, AliasAnalysis::ModRefResult::Mod);
CheckModRef(Load1, AliasAnalysis::ModRefResult::Ref);
CheckModRef(Add1, AliasAnalysis::ModRefResult::NoModRef);
CheckModRef(VAArg1, AliasAnalysis::ModRefResult::ModRef);
CheckModRef(CmpXChg1, AliasAnalysis::ModRefResult::ModRef);
CheckModRef(AtomicRMW, AliasAnalysis::ModRefResult::ModRef);
CheckModRef(Store1, MRI_Mod);
CheckModRef(Load1, MRI_Ref);
CheckModRef(Add1, MRI_NoModRef);
CheckModRef(VAArg1, MRI_ModRef);
CheckModRef(CmpXChg1, MRI_ModRef);
CheckModRef(AtomicRMW, MRI_ModRef);
}
} // end anonymous namspace