From f1fc8f88681c988608dabbbb01734db79b328d71 Mon Sep 17 00:00:00 2001 From: binaryfz Date: Fri, 21 Feb 2020 16:37:52 +0800 Subject: [PATCH] code refactor --- src/maple_me/include/me_cond_based.h | 2 +- src/maple_me/include/me_ssu_pre.h | 28 ++++++++++++++-------------- src/maple_me/src/me_ssu_pre.cpp | 2 +- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/maple_me/include/me_cond_based.h b/src/maple_me/include/me_cond_based.h index 26e00d8d63..614cead1d7 100644 --- a/src/maple_me/include/me_cond_based.h +++ b/src/maple_me/include/me_cond_based.h @@ -28,7 +28,7 @@ class MeCondBased { bool NullValueFromTestCond(VarMeExpr&, BB&, bool); bool IsNotNullValue(VarMeExpr&, UnaryMeStmt&, BB*); - MeFunction *GetFunc() const { + const MeFunction *GetFunc() const { return func; } diff --git a/src/maple_me/include/me_ssu_pre.h b/src/maple_me/include/me_ssu_pre.h index 0de4d9c229..10c5e89204 100644 --- a/src/maple_me/include/me_ssu_pre.h +++ b/src/maple_me/include/me_ssu_pre.h @@ -40,7 +40,7 @@ class SOcc { return dom->PostDominate(*mirBB, *occ->mirBB); } - SOccType GetOccTy() { + SOccType GetOccTy() const { return occTy; } @@ -48,7 +48,7 @@ class SOcc { this->occTy = type; } - uint32 GetClassId() { + uint32 GetClassId() const { return classId; } @@ -68,7 +68,7 @@ class SOcc { this->mirBB = currMirBB; } - SOcc *GetUse() { + SOcc *GetUse() const { return use; } @@ -108,7 +108,7 @@ class SRealOcc : public SOcc { return vMeExpr; } - bool GetRealFromDef() { + bool GetRealFromDef() const { return realFromDef; } @@ -139,7 +139,7 @@ class SLambdaResOcc : public SOcc { LogInfo::MapleLogger() << "LambdaResOcc at bb" << GetBB()->GetBBId() << " classId" << GetClassId(); } - SLambdaOcc *GetUseLambdaOcc() { + const SLambdaOcc *GetUseLambdaOcc() const { return useLambdaOcc; } @@ -147,7 +147,7 @@ class SLambdaResOcc : public SOcc { this->useLambdaOcc = currUseLambdaOcc; } - bool GetHasRealUse() { + bool GetHasRealUse() const { return hasRealUse; } @@ -155,7 +155,7 @@ class SLambdaResOcc : public SOcc { this->hasRealUse = has; } - bool GetInsertHere() { + bool GetInsertHere() const { return insertHere; } @@ -188,7 +188,7 @@ class SLambdaOcc : public SOcc { LogInfo::MapleLogger() << "]"; } - bool GetIsUpsafe() { + bool GetIsUpsafe() const { return isUpsafe; } @@ -196,7 +196,7 @@ class SLambdaOcc : public SOcc { this->isUpsafe = upsafe; } - bool GetIsCanBeAnt() { + bool GetIsCanBeAnt() const { return isCanBeAnt; } @@ -204,7 +204,7 @@ class SLambdaOcc : public SOcc { this->isCanBeAnt = canBeAnt; } - bool GetIsEarlier() { + bool GetIsEarlier() const { return isEarlier; } @@ -280,7 +280,7 @@ class SpreWorkCand { ~SpreWorkCand() = default; - SpreWorkCand *GetNext() { + const SpreWorkCand *GetNext() const { return next; } @@ -288,7 +288,7 @@ class SpreWorkCand { return theOst; } - VarMeExpr *GetTheVar() { + const VarMeExpr *GetTheVar() const { return theVar; } @@ -300,7 +300,7 @@ class SpreWorkCand { return realOccs; } - bool GetHasStoreOcc() { + bool GetHasStoreOcc() const { return hasStoreOcc; } @@ -308,7 +308,7 @@ class SpreWorkCand { this->hasStoreOcc = has; } - bool GetHasCriticalEdge() { + bool GetHasCriticalEdge() const { return hasCriticalEdge; } diff --git a/src/maple_me/src/me_ssu_pre.cpp b/src/maple_me/src/me_ssu_pre.cpp index 1f60375d07..d310b093c4 100644 --- a/src/maple_me/src/me_ssu_pre.cpp +++ b/src/maple_me/src/me_ssu_pre.cpp @@ -43,7 +43,7 @@ void MeSSUPre::Finalize() { } case kSOccLambdaRes: { auto *lambdaResOcc = static_cast(occ); - SLambdaOcc *lambdaOcc = lambdaResOcc->GetUseLambdaOcc(); + const SLambdaOcc *lambdaOcc = lambdaResOcc->GetUseLambdaOcc(); if (lambdaOcc->WillBeAnt()) { if (lambdaResOcc->GetUse() == nullptr || (!lambdaResOcc->GetHasRealUse() && lambdaResOcc->GetUse()->GetOccTy() == kSOccLambda && -- Gitee