From 6981a90700b1c79b78cf117d27c69fa41466736a Mon Sep 17 00:00:00 2001 From: caheckman <48068198+caheckman@users.noreply.github.com> Date: Wed, 29 Mar 2023 18:23:56 -0400 Subject: [PATCH] GP-3269 Never input cast to SUBPIECE or PIECE --- .../Features/Decompiler/src/decompile/cpp/typeop.cc | 12 ++++++++++++ .../Features/Decompiler/src/decompile/cpp/typeop.hh | 4 ++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/typeop.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/typeop.cc index 882bb39211..f71e96e293 100644 --- a/Ghidra/Features/Decompiler/src/decompile/cpp/typeop.cc +++ b/Ghidra/Features/Decompiler/src/decompile/cpp/typeop.cc @@ -1899,6 +1899,12 @@ string TypeOpPiece::getOperatorName(const PcodeOp *op) const return s.str(); } +Datatype *TypeOpPiece::getInputCast(const PcodeOp *op,int4 slot,const CastStrategy *castStrategy) const + +{ + return (Datatype *)0; // Never need a cast into a PIECE +} + Datatype *TypeOpPiece::getOutputToken(const PcodeOp *op,CastStrategy *castStrategy) const { @@ -1926,6 +1932,12 @@ string TypeOpSubpiece::getOperatorName(const PcodeOp *op) const return s.str(); } +Datatype *TypeOpSubpiece::getInputCast(const PcodeOp *op,int4 slot,const CastStrategy *castStrategy) const + +{ + return (Datatype *)0; // Never need a cast into a SUBPIECE +} + Datatype *TypeOpSubpiece::getOutputToken(const PcodeOp *op,CastStrategy *castStrategy) const { diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/typeop.hh b/Ghidra/Features/Decompiler/src/decompile/cpp/typeop.hh index 78af793ead..4e8c143bc8 100644 --- a/Ghidra/Features/Decompiler/src/decompile/cpp/typeop.hh +++ b/Ghidra/Features/Decompiler/src/decompile/cpp/typeop.hh @@ -733,6 +733,7 @@ public: class TypeOpPiece : public TypeOpFunc { public: TypeOpPiece(TypeFactory *t); ///< Constructor + virtual Datatype *getInputCast(const PcodeOp *op,int4 slot,const CastStrategy *castStrategy) const; virtual Datatype *getOutputToken(const PcodeOp *op,CastStrategy *castStrategy) const; virtual string getOperatorName(const PcodeOp *op) const; virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opPiece(op); } @@ -742,8 +743,7 @@ public: class TypeOpSubpiece : public TypeOpFunc { public: TypeOpSubpiece(TypeFactory *t); ///< Constructor - // virtual Datatype *getOutputLocal(const PcodeOp *op) const; - // virtual Datatype *getInputLocal(const PcodeOp *op,int4 slot) const; + virtual Datatype *getInputCast(const PcodeOp *op,int4 slot,const CastStrategy *castStrategy) const; virtual Datatype *getOutputToken(const PcodeOp *op,CastStrategy *castStrategy) const; virtual Datatype *propagateType(Datatype *alttype,PcodeOp *op,Varnode *invn,Varnode *outvn, int4 inslot,int4 outslot);