From: Nikos Nikoleris <nikos.nikoleris@arm.com> Date: Wed, 30 Oct 2019 22:45:36 +0000 (+0100) Subject: arch-arm: Simplify AMO code generation templates X-Git-Tag: v19.0.0.0~324 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3791b605f8e89887af23f54d95c202ac1d5a6101;p=gem5.git arch-arm: Simplify AMO code generation templates This change simplifies the isa template for the atomic memory operation (AMO). Previously the flow had unecessary if statements that ended up breaking build using clang, due to variables that could seemingly be used before they were unitialized. Change-Id: I1b46dfd5f1e90377245c4f649c08b6532b507b9c Signed-off-by: Nikos Nikoleris <nikos.nikoleris@arm.com> Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/22603 Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com> Tested-by: kokoro <noreply+kokoro@google.com> --- diff --git a/src/arch/arm/isa/templates/mem64.isa b/src/arch/arm/isa/templates/mem64.isa index e5df80155..3d0302a73 100644 --- a/src/arch/arm/isa/templates/mem64.isa +++ b/src/arch/arm/isa/templates/mem64.isa @@ -737,34 +737,27 @@ def template AmoOpExecute {{ Trace::InstRecord *traceData) const { Addr EA; - Fault fault = NoFault; %(op_decl)s; %(op_rd)s; %(ea_code)s; %(usrDecl)s; - if (fault == NoFault) { - %(memacc_code)s; - } - %(amo_code)s + %(memacc_code)s; + + %(amo_code)s; assert(amo_op); - if (fault == NoFault) { - fault = amoMemAtomic(xc, traceData, Mem, EA, - memAccessFlags, amo_op); - } + const Fault fault = amoMemAtomic(xc, traceData, Mem, EA, + memAccessFlags, amo_op); if (fault == NoFault) { %(postacc_code)s; - } - - if (fault == NoFault) { %(op_wb)s; } - return fault; + return fault; } }}; @@ -773,26 +766,19 @@ def template AmoOpInitiateAcc {{ Trace::InstRecord *traceData) const { Addr EA; - Fault fault = NoFault; %(op_src_decl)s; %(op_rd)s; %(ea_code)s; %(usrDecl)s; - if (fault == NoFault) { - %(memacc_code)s; - } + %(memacc_code)s; %(amo_code)s; assert(amo_op); - if (fault == NoFault) { - fault = initiateMemAMO(xc, traceData, EA, Mem, memAccessFlags, - amo_op); - } - - return fault; + return initiateMemAMO(xc, traceData, EA, Mem, memAccessFlags, + amo_op); } }}; @@ -800,23 +786,17 @@ def template AmoOpCompleteAcc {{ Fault %(class_name)s::completeAcc(PacketPtr pkt, ExecContext *xc, Trace::InstRecord *traceData) const { - Fault fault = NoFault; - - %(op_decl)s; - %(op_rd)s; + %(op_decl)s; + %(op_rd)s; // ARM instructions will not have a pkt if the predicate is false getMem(pkt, Mem, traceData); - if (fault == NoFault) { - %(postacc_code)s; - } + %(postacc_code)s; - if (fault == NoFault) { - %(op_wb)s; - } + %(op_wb)s; - return fault; + return NoFault; } }};