From 3791b605f8e89887af23f54d95c202ac1d5a6101 Mon Sep 17 00:00:00 2001 From: Nikos Nikoleris Date: Wed, 30 Oct 2019 23:45:36 +0100 Subject: [PATCH] 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 Reviewed-by: Giacomo Travaglini Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/22603 Maintainer: Giacomo Travaglini Tested-by: kokoro --- src/arch/arm/isa/templates/mem64.isa | 48 ++++++++-------------------- 1 file changed, 14 insertions(+), 34 deletions(-) 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; } }}; -- 2.30.2