[llvm] r279574 - [stackmaps] Extract out magic constants [NFCI]

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 23 15:26:06 PDT 2016


In my view, this falls solidly into the category of things which should 
not be an error.  A warning is debatable, but an error is ridiculous.

Philip

On 08/23/2016 03:19 PM, Richard Smith wrote:
> I've temporarily removed the unused data member in r279581.
>
> On Tue, Aug 23, 2016 at 3:12 PM, Richard Smith <richard at metafoo.co.uk 
> <mailto:richard at metafoo.co.uk>> wrote:
>
>     On Tue, Aug 23, 2016 at 3:06 PM, Mehdi Amini via llvm-commits
>     <llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>>
>     wrote:
>
>         Hi Philip,
>
>         I assume it is a work-in-progress, but just to let you know I
>         have a warning with this:
>
>         /llvm/src/include/llvm/CodeGen/StackMaps.h:35:23: warning:
>         private field 'MI' is not used [-Wunused-private-field]
>           const MachineInstr *MI;
>                               ^
>
>
>     We're seeing this too; please fix or revert, this breaks -Werror
>     builds.
>
>
>>
>         Mehdi
>
>
>         > On Aug 23, 2016, at 2:21 PM, Philip Reames via llvm-commits
>         <llvm-commits at lists.llvm.org
>         <mailto:llvm-commits at lists.llvm.org>> wrote:
>         >
>         > Author: reames
>         > Date: Tue Aug 23 16:21:43 2016
>         > New Revision: 279574
>         >
>         > URL: http://llvm.org/viewvc/llvm-project?rev=279574&view=rev
>         <http://llvm.org/viewvc/llvm-project?rev=279574&view=rev>
>         > Log:
>         > [stackmaps] Extract out magic constants [NFCI]
>         >
>         > This is a first step towards clarifying the exact MI
>         semantics of stackmap's "live values".
>         >
>         >
>         > Modified:
>         >    llvm/trunk/include/llvm/CodeGen/StackMaps.h
>         >    llvm/trunk/lib/CodeGen/StackMaps.cpp
>         >    llvm/trunk/lib/CodeGen/TargetInstrInfo.cpp
>         >
>         > Modified: llvm/trunk/include/llvm/CodeGen/StackMaps.h
>         > URL:
>         http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/StackMaps.h?rev=279574&r1=279573&r2=279574&view=diff
>         <http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/StackMaps.h?rev=279574&r1=279573&r2=279574&view=diff>
>         >
>         ==============================================================================
>         > --- llvm/trunk/include/llvm/CodeGen/StackMaps.h (original)
>         > +++ llvm/trunk/include/llvm/CodeGen/StackMaps.h Tue Aug 23
>         16:21:43 2016
>         > @@ -22,6 +22,29 @@ class AsmPrinter;
>         > class MCExpr;
>         > class MCStreamer;
>         >
>         > +/// \brief MI-level stackmap operands.
>         > +///
>         > +/// MI slackmap operations take the form:
>         > +/// <id>, <numBytes>, live args...
>         > +class StackMapOpers {
>         > +public:
>         > +  /// Enumerate the meta operands.
>         > +  enum { IDPos, NBytesPos };
>         > +
>         > +private:
>         > +  const MachineInstr *MI;
>         > +
>         > +public:
>         > +  explicit StackMapOpers(const MachineInstr *MI);
>         > +
>         > +  /// Get the operand index of the variable list of
>         non-argument operands.
>         > +  /// These hold the "live state".
>         > +  unsigned getVarIdx() const {
>         > +    // Skip ID, nShadowBytes.
>         > +    return 2;
>         > +  }
>         > +};
>         > +
>         > /// \brief MI-level patchpoint operands.
>         > ///
>         > /// MI patchpoint operations take the form:
>         >
>         > Modified: llvm/trunk/lib/CodeGen/StackMaps.cpp
>         > URL:
>         http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/StackMaps.cpp?rev=279574&r1=279573&r2=279574&view=diff
>         <http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/StackMaps.cpp?rev=279574&r1=279573&r2=279574&view=diff>
>         >
>         ==============================================================================
>         > --- llvm/trunk/lib/CodeGen/StackMaps.cpp (original)
>         > +++ llvm/trunk/lib/CodeGen/StackMaps.cpp Tue Aug 23 16:21:43
>         2016
>         > @@ -35,6 +35,12 @@ static cl::opt<int> StackMapVersion(
>         >
>         > const char *StackMaps::WSMP = "Stack Maps: ";
>         >
>         > +StackMapOpers::StackMapOpers(const MachineInstr *MI)
>         > +  : MI(MI) {
>         > +  assert(getVarIdx() <= MI->getNumOperands() &&
>         > +         "invalid stackmap definition");
>         > +}
>         > +
>         > PatchPointOpers::PatchPointOpers(const MachineInstr *MI)
>         >     : MI(MI), HasDef(MI->getOperand(0).isReg() &&
>         MI->getOperand(0).isDef() &&
>         > !MI->getOperand(0).isImplicit()),
>         > @@ -343,8 +349,9 @@ void StackMaps::recordStackMapOpers(cons
>         > void StackMaps::recordStackMap(const MachineInstr &MI) {
>         >   assert(MI.getOpcode() == TargetOpcode::STACKMAP &&
>         "expected stackmap");
>         >
>         > -  int64_t ID = MI.getOperand(0).getImm();
>         > -  recordStackMapOpers(MI, ID,
>         std::next(MI.operands_begin(), 2),
>         > +  StackMapOpers opers(&MI);
>         > +  const int64_t ID =
>         MI.getOperand(PatchPointOpers::IDPos).getImm();
>         > +  recordStackMapOpers(MI, ID,
>         std::next(MI.operands_begin(), opers.getVarIdx()),
>         >  MI.operands_end());
>         > }
>         >
>         > @@ -352,7 +359,7 @@ void StackMaps::recordPatchPoint(const M
>         >   assert(MI.getOpcode() == TargetOpcode::PATCHPOINT &&
>         "expected patchpoint");
>         >
>         >   PatchPointOpers opers(&MI);
>         > -  int64_t ID =
>         opers.getMetaOper(PatchPointOpers::IDPos).getImm();
>         > +  const int64_t ID =
>         opers.getMetaOper(PatchPointOpers::IDPos).getImm();
>         >
>         >   auto MOI = std::next(MI.operands_begin(),
>         opers.getStackMapStartIdx());
>         >   recordStackMapOpers(MI, ID, MOI, MI.operands_end(),
>         >
>         > Modified: llvm/trunk/lib/CodeGen/TargetInstrInfo.cpp
>         > URL:
>         http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TargetInstrInfo.cpp?rev=279574&r1=279573&r2=279574&view=diff
>         <http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TargetInstrInfo.cpp?rev=279574&r1=279573&r2=279574&view=diff>
>         >
>         ==============================================================================
>         > --- llvm/trunk/lib/CodeGen/TargetInstrInfo.cpp (original)
>         > +++ llvm/trunk/lib/CodeGen/TargetInstrInfo.cpp Tue Aug 23
>         16:21:43 2016
>         > @@ -437,11 +437,15 @@ static MachineInstr *foldPatchpoint(Mach
>         >  const TargetInstrInfo &TII) {
>         >   unsigned StartIdx = 0;
>         >   switch (MI.getOpcode()) {
>         > -  case TargetOpcode::STACKMAP:
>         > -    StartIdx = 2; // Skip ID, nShadowBytes.
>         > +  case TargetOpcode::STACKMAP: {
>         > +    // StackMapLiveValues are foldable
>         > +    StackMapOpers opers(&MI);
>         > +    StartIdx = opers.getVarIdx();
>         >     break;
>         > +  }
>         >   case TargetOpcode::PATCHPOINT: {
>         > -    // For PatchPoint, the call args are not foldable.
>         > +    // For PatchPoint, the call args are not foldable (even
>         if reported in the
>         > +    // stackmap e.g. via anyregcc).
>         >     PatchPointOpers opers(&MI);
>         >     StartIdx = opers.getVarIdx();
>         >     break;
>         >
>         >
>         > _______________________________________________
>         > llvm-commits mailing list
>         > llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>
>         > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>         <http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits>
>
>         _______________________________________________
>         llvm-commits mailing list
>         llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>
>         http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>         <http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits>
>
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160823/590902a4/attachment.html>


More information about the llvm-commits mailing list