[X86] Clarify some stackmap shadow optimization code as based on review
feedback from Eric Christopher.
No functional change.
llvm-svn: 213917
diff --git a/llvm/lib/Target/X86/X86AsmPrinter.h b/llvm/lib/Target/X86/X86AsmPrinter.h
index 4b9913c..fdec333 100644
--- a/llvm/lib/Target/X86/X86AsmPrinter.h
+++ b/llvm/lib/Target/X86/X86AsmPrinter.h
@@ -44,16 +44,27 @@
~StackMapShadowTracker();
void startFunction(MachineFunction &MF);
void count(MCInst &Inst, const MCSubtargetInfo &STI);
+
+ // Called to signal the start of a shadow of RequiredSize bytes.
void reset(unsigned RequiredSize) {
RequiredShadowSize = RequiredSize;
CurrentShadowSize = 0;
- Count = true;
+ InShadow = true;
}
+
+ // Called before every stackmap/patchpoint, and at the end of basic blocks,
+ // to emit any necessary padding-NOPs.
void emitShadowPadding(MCStreamer &OutStreamer, const MCSubtargetInfo &STI);
private:
TargetMachine &TM;
std::unique_ptr<MCCodeEmitter> CodeEmitter;
- bool Count;
+ bool InShadow;
+
+ // RequiredShadowSize holds the length of the shadow specified in the most
+ // recently encountered STACKMAP instruction.
+ // CurrentShadowSize counts the number of bytes encoded since the most
+ // recently encountered STACKMAP, stopping when that number is greater than
+ // or equal to RequiredShadowSize.
unsigned RequiredShadowSize, CurrentShadowSize;
};