diff options
author | Nikos Nikoleris <nikos.nikoleris@arm.com> | 2019-10-30 23:45:36 +0100 |
---|---|---|
committer | Nikos Nikoleris <nikos.nikoleris@arm.com> | 2019-11-06 20:54:38 +0000 |
commit | 3791b605f8e89887af23f54d95c202ac1d5a6101 (patch) | |
tree | c0e5a3c2bab0192526d6a67c2fcd4e6480760ec8 | |
parent | 29fce1d26b395f3a82f757ea37f4c53da8fbde11 (diff) | |
download | gem5-3791b605f8e89887af23f54d95c202ac1d5a6101.tar.xz |
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>
-rw-r--r-- | src/arch/arm/isa/templates/mem64.isa | 48 |
1 files 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; } }}; |