Skip to content

Commit

Permalink
Rename Finalising to Finalizing
Browse files Browse the repository at this point in the history
  • Loading branch information
PetroZarytskyi authored and vgvassilev committed Mar 12, 2024
1 parent e78a215 commit 24d2461
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 28 deletions.
8 changes: 4 additions & 4 deletions include/clad/Differentiator/ErrorEstimator.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,18 +172,18 @@ class ErrorEstimationHandler : public ExternalRMVSource {
void ActBeforeDifferentiatingStmtInVisitCompoundStmt() override;
void ActAfterProcessingStmtInVisitCompoundStmt() override;
void ActBeforeDifferentiatingSingleStmtBranchInVisitIfStmt() override;
void ActBeforeFinalisingVisitBranchSingleStmtInIfVisitStmt() override;
void ActBeforeFinalizingVisitBranchSingleStmtInIfVisitStmt() override;
void ActBeforeDifferentiatingLoopInitStmt() override;
void ActBeforeDifferentiatingSingleStmtLoopBody() override;
void ActAfterProcessingSingleStmtBodyInVisitForLoop() override;
void ActBeforeFinalisingVisitReturnStmt(StmtDiff& retExprDiff) override;
void ActBeforeFinalisingPostIncDecOp(StmtDiff& diff) override;
void ActBeforeFinalizingVisitReturnStmt(StmtDiff& retExprDiff) override;
void ActBeforeFinalizingPostIncDecOp(StmtDiff& diff) override;
void ActBeforeFinalizingVisitCallExpr(
const clang::CallExpr*& CE, clang::Expr*& fnDecl,
llvm::SmallVectorImpl<clang::Expr*>& derivedCallArgs,
llvm::SmallVectorImpl<clang::VarDecl*>& ArgResultDecls,
bool asGrad) override;
void ActBeforeFinalisingAssignOp(clang::Expr*&, clang::Expr*&, clang::Expr*&,
void ActBeforeFinalizingAssignOp(clang::Expr*&, clang::Expr*&, clang::Expr*&,
clang::BinaryOperator::Opcode&) override;
void ActBeforeFinalizingDifferentiateSingleStmt(const direction& d) override;
void ActBeforeFinalizingDifferentiateSingleExpr(const direction& d) override;
Expand Down
8 changes: 4 additions & 4 deletions include/clad/Differentiator/ExternalRMVSource.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class ExternalRMVSource {

/// This is called just before finalising processing of Single statement
/// branch in `VisitBranch` lambda in
virtual void ActBeforeFinalisingVisitBranchSingleStmtInIfVisitStmt() {}
virtual void ActBeforeFinalizingVisitBranchSingleStmtInIfVisitStmt() {}

/// This is called just before differentiating init statement of loops.
virtual void ActBeforeDifferentiatingLoopInitStmt() {}
Expand All @@ -117,7 +117,7 @@ class ExternalRMVSource {
virtual void ActAfterProcessingSingleStmtBodyInVisitForLoop() {}

/// This is called just before finalising `VisitReturnStmt`.
virtual void ActBeforeFinalisingVisitReturnStmt(StmtDiff& retExprDiff) {}
virtual void ActBeforeFinalizingVisitReturnStmt(StmtDiff& retExprDiff) {}

/// This ic called just before finalising `VisitCallExpr`.
///
Expand All @@ -131,15 +131,15 @@ class ExternalRMVSource {

/// This is called just before finalising processing of post and pre
/// increment and decrement operations.
virtual void ActBeforeFinalisingPostIncDecOp(StmtDiff& diff){};
virtual void ActBeforeFinalizingPostIncDecOp(StmtDiff& diff){};

/// This is called just after cloning of LHS assignment operation.
virtual void ActAfterCloningLHSOfAssignOp(clang::Expr*&, clang::Expr*&,
clang::BinaryOperatorKind& opCode) {
}

/// This is called just after finalising processing of assignment operator.
virtual void ActBeforeFinalisingAssignOp(clang::Expr*&, clang::Expr*&,
virtual void ActBeforeFinalizingAssignOp(clang::Expr*&, clang::Expr*&,
clang::Expr*&,
clang::BinaryOperator::Opcode&){};

Expand Down
8 changes: 4 additions & 4 deletions include/clad/Differentiator/MultiplexExternalRMVSource.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,20 @@ class MultiplexExternalRMVSource : public ExternalRMVSource {
void ActBeforeDifferentiatingStmtInVisitCompoundStmt() override;
void ActAfterProcessingStmtInVisitCompoundStmt() override;
void ActBeforeDifferentiatingSingleStmtBranchInVisitIfStmt() override;
void ActBeforeFinalisingVisitBranchSingleStmtInIfVisitStmt() override;
void ActBeforeFinalizingVisitBranchSingleStmtInIfVisitStmt() override;
void ActBeforeDifferentiatingLoopInitStmt() override;
void ActBeforeDifferentiatingSingleStmtLoopBody() override;
void ActAfterProcessingSingleStmtBodyInVisitForLoop() override;
void ActBeforeFinalisingVisitReturnStmt(StmtDiff& retExprDiff) override;
void ActBeforeFinalizingVisitReturnStmt(StmtDiff& retExprDiff) override;
void ActBeforeFinalizingVisitCallExpr(
const clang::CallExpr*& CE, clang::Expr*& OverloadedDerivedFn,
llvm::SmallVectorImpl<clang::Expr*>& derivedCallArgs,
llvm::SmallVectorImpl<clang::VarDecl*>& ArgResultDecls,
bool asGrad) override;
void ActBeforeFinalisingPostIncDecOp(StmtDiff& diff) override;
void ActBeforeFinalizingPostIncDecOp(StmtDiff& diff) override;
void ActAfterCloningLHSOfAssignOp(clang::Expr*&, clang::Expr*&,
clang::BinaryOperatorKind& opCode) override;
void ActBeforeFinalisingAssignOp(clang::Expr*&, clang::Expr*&, clang::Expr*&,
void ActBeforeFinalizingAssignOp(clang::Expr*&, clang::Expr*&, clang::Expr*&,
clang::BinaryOperator::Opcode&) override;
void ActOnStartOfDifferentiateSingleStmt() override;
void ActBeforeFinalizingDifferentiateSingleStmt(const direction& d) override;
Expand Down
8 changes: 4 additions & 4 deletions lib/Differentiator/ErrorEstimator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ void ErrorEstimationHandler::
}

void ErrorEstimationHandler::
ActBeforeFinalisingVisitBranchSingleStmtInIfVisitStmt() {
ActBeforeFinalizingVisitBranchSingleStmtInIfVisitStmt() {
// In error estimation, manually emit the code here instead of
// DifferentiateSingleStmt to maintain correct order.
EmitErrorEstimationStmts(direction::forward);
Expand All @@ -354,15 +354,15 @@ void ErrorEstimationHandler::ActAfterProcessingSingleStmtBodyInVisitForLoop() {
EmitErrorEstimationStmts(direction::forward);
}

void ErrorEstimationHandler::ActBeforeFinalisingVisitReturnStmt(
void ErrorEstimationHandler::ActBeforeFinalizingVisitReturnStmt(
StmtDiff& retExprDiff) {
// If the return expression is not a DeclRefExpression and is of type
// float, we should add it to the error estimate because returns are
// similiar to implicit assigns.
SaveReturnExpr(retExprDiff.getExpr());
}

void ErrorEstimationHandler::ActBeforeFinalisingPostIncDecOp(StmtDiff& diff) {
void ErrorEstimationHandler::ActBeforeFinalizingPostIncDecOp(StmtDiff& diff) {
EmitUnaryOpErrorStmts(diff, m_RMV->isInsideLoop);
}

Expand All @@ -387,7 +387,7 @@ void ErrorEstimationHandler::ActBeforeFinalizingVisitCallExpr(
}
}

void ErrorEstimationHandler::ActBeforeFinalisingAssignOp(
void ErrorEstimationHandler::ActBeforeFinalizingAssignOp(
clang::Expr*& LCloned, clang::Expr*& oldValue, clang::Expr*& R,
clang::BinaryOperator::Opcode& opCode) {
// In the case that an RHS expression is a declReference, we do not emit
Expand Down
16 changes: 8 additions & 8 deletions lib/Differentiator/MultiplexExternalRMVSource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ void MultiplexExternalRMVSource::
}

void MultiplexExternalRMVSource::
ActBeforeFinalisingVisitBranchSingleStmtInIfVisitStmt() {
ActBeforeFinalizingVisitBranchSingleStmtInIfVisitStmt() {
for (auto source : m_Sources) {
source->ActBeforeFinalisingVisitBranchSingleStmtInIfVisitStmt();
source->ActBeforeFinalizingVisitBranchSingleStmtInIfVisitStmt();
}
}

Expand All @@ -139,10 +139,10 @@ void MultiplexExternalRMVSource::
}
}

void MultiplexExternalRMVSource::ActBeforeFinalisingVisitReturnStmt(
void MultiplexExternalRMVSource::ActBeforeFinalizingVisitReturnStmt(
StmtDiff& retExprDiff) {
for (auto source : m_Sources) {
source->ActBeforeFinalisingVisitReturnStmt(retExprDiff);
source->ActBeforeFinalizingVisitReturnStmt(retExprDiff);
}
}

Expand All @@ -156,10 +156,10 @@ void MultiplexExternalRMVSource::ActBeforeFinalizingVisitCallExpr(
}
}

void MultiplexExternalRMVSource::ActBeforeFinalisingPostIncDecOp(
void MultiplexExternalRMVSource::ActBeforeFinalizingPostIncDecOp(
StmtDiff& diff) {
for (auto source : m_Sources) {
source->ActBeforeFinalisingPostIncDecOp(diff);
source->ActBeforeFinalizingPostIncDecOp(diff);
}
}
void MultiplexExternalRMVSource::ActAfterCloningLHSOfAssignOp(
Expand All @@ -169,11 +169,11 @@ void MultiplexExternalRMVSource::ActAfterCloningLHSOfAssignOp(
}
}

void MultiplexExternalRMVSource::ActBeforeFinalisingAssignOp(
void MultiplexExternalRMVSource::ActBeforeFinalizingAssignOp(
clang::Expr*& LCloned, clang::Expr*& oldValue, clang::Expr*& R,
clang::BinaryOperator::Opcode& opCode) {
for (auto source : m_Sources) {
source->ActBeforeFinalisingAssignOp(LCloned, oldValue, R, opCode);
source->ActBeforeFinalizingAssignOp(LCloned, oldValue, R, opCode);
}
}

Expand Down
8 changes: 4 additions & 4 deletions lib/Differentiator/ReverseModeVisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -890,7 +890,7 @@ Expr* getArraySizeExpr(const ArrayType* AT, ASTContext& context,

if (m_ExternalSource)
m_ExternalSource
->ActBeforeFinalisingVisitBranchSingleStmtInIfVisitStmt();
->ActBeforeFinalizingVisitBranchSingleStmtInIfVisitStmt();

Stmt* Forward = unwrapIfSingleStmt(endBlock(direction::forward));
Stmt* Reverse = unwrapIfSingleStmt(BranchDiff.getStmt_dx());
Expand Down Expand Up @@ -1215,7 +1215,7 @@ Expr* getArraySizeExpr(const ArrayType* AT, ASTContext& context,
// ValueAndPushforward.
if (!isCladValueAndPushforwardType(type)) {
if (m_ExternalSource)
m_ExternalSource->ActBeforeFinalisingVisitReturnStmt(ExprDiff);
m_ExternalSource->ActBeforeFinalizingVisitReturnStmt(ExprDiff);
}

// Create goto to the label.
Expand Down Expand Up @@ -2168,7 +2168,7 @@ Expr* getArraySizeExpr(const ArrayType* AT, ASTContext& context,
ResultRef = diff_dx;
valueForRevPass = diff.getRevSweepAsExpr();
if (m_ExternalSource)
m_ExternalSource->ActBeforeFinalisingPostIncDecOp(diff);
m_ExternalSource->ActBeforeFinalizingPostIncDecOp(diff);
} else if (opCode == UO_PreInc || opCode == UO_PreDec) {
diff = Visit(E, dfdx());
Expr* diff_dx = diff.getExpr_dx();
Expand Down Expand Up @@ -2572,7 +2572,7 @@ Expr* getArraySizeExpr(const ArrayType* AT, ASTContext& context,
} else
llvm_unreachable("unknown assignment opCode");
if (m_ExternalSource)
m_ExternalSource->ActBeforeFinalisingAssignOp(LCloned, ResultRef, R,
m_ExternalSource->ActBeforeFinalizingAssignOp(LCloned, ResultRef, R,
opCode);

// Output statements from Visit(L).
Expand Down

0 comments on commit 24d2461

Please sign in to comment.