Lines Matching refs:Out
188 MCStreamer &Out) override { in InstrumentAndEmitInstruction() argument
189 InstrumentMOVS(Inst, Operands, Ctx, MII, Out); in InstrumentAndEmitInstruction()
191 EmitInstruction(Out, MCInstBuilder(X86::REP_PREFIX)); in InstrumentAndEmitInstruction()
193 InstrumentMOV(Inst, Operands, Ctx, MII, Out); in InstrumentAndEmitInstruction()
197 EmitInstruction(Out, Inst); in InstrumentAndEmitInstruction()
203 MCStreamer &Out) = 0;
208 MCStreamer &Out) = 0;
213 MCContext &Ctx, MCStreamer &Out) = 0;
217 MCContext &Ctx, MCStreamer &Out) = 0;
220 MCStreamer &Out) = 0;
224 MCStreamer &Out);
226 unsigned AccessSize, MCContext &Ctx, MCStreamer &Out);
229 MCContext &Ctx, const MCInstrInfo &MII, MCStreamer &Out);
231 MCContext &Ctx, const MCInstrInfo &MII, MCStreamer &Out);
234 void EmitLabel(MCStreamer &Out, MCSymbol *Label) { Out.EmitLabel(Label); } in EmitLabel() argument
236 void EmitLEA(X86Operand &Op, unsigned Size, unsigned Reg, MCStreamer &Out) { in EmitLEA() argument
242 EmitInstruction(Out, Inst); in EmitLEA()
246 unsigned Reg, MCContext &Ctx, MCStreamer &Out);
281 const RegisterContext &RegCtx, MCContext &Ctx, MCStreamer &Out) { in InstrumentMemOperand() argument
287 InstrumentMemOperandSmall(Op, AccessSize, IsWrite, RegCtx, Ctx, Out); in InstrumentMemOperand()
289 InstrumentMemOperandLarge(Op, AccessSize, IsWrite, RegCtx, Ctx, Out); in InstrumentMemOperand()
295 MCContext &Ctx, MCStreamer &Out) { in InstrumentMOVSBase() argument
306 InstrumentMemOperandPrologue(RegCtx, Ctx, Out); in InstrumentMOVSBase()
314 Out); in InstrumentMOVSBase()
324 Out); in InstrumentMOVSBase()
332 InstrumentMemOperand(*Op, AccessSize, true /* IsWrite */, RegCtx, Ctx, Out); in InstrumentMOVSBase()
341 InstrumentMemOperand(*Op, AccessSize, true /* IsWrite */, RegCtx, Ctx, Out); in InstrumentMOVSBase()
344 InstrumentMemOperandEpilogue(RegCtx, Ctx, Out); in InstrumentMOVSBase()
350 MCStreamer &Out) { in InstrumentMOVS() argument
371 InstrumentMOVSImpl(AccessSize, Ctx, Out); in InstrumentMOVS()
377 MCStreamer &Out) { in InstrumentMOV() argument
424 InstrumentMemOperandPrologue(RegCtx, Ctx, Out); in InstrumentMOV()
425 InstrumentMemOperand(MemOp, AccessSize, IsWrite, RegCtx, Ctx, Out); in InstrumentMOV()
426 InstrumentMemOperandEpilogue(RegCtx, Ctx, Out); in InstrumentMOV()
434 MCStreamer &Out) { in ComputeMemOperandAddress() argument
445 EmitLEA(Op, Size, Reg, Out); in ComputeMemOperandAddress()
452 EmitLEA(*NewOp, Size, Reg, Out); in ComputeMemOperandAddress()
460 EmitLEA(*DispOp, Size, Reg, Out); in ComputeMemOperandAddress()
503 unsigned GetFrameReg(const MCContext &Ctx, MCStreamer &Out) { in GetFrameReg() argument
504 unsigned FrameReg = GetFrameRegGeneric(Ctx, Out); in GetFrameReg()
510 void SpillReg(MCStreamer &Out, unsigned Reg) { in SpillReg() argument
511 EmitInstruction(Out, MCInstBuilder(X86::PUSH32r).addReg(Reg)); in SpillReg()
515 void RestoreReg(MCStreamer &Out, unsigned Reg) { in RestoreReg() argument
516 EmitInstruction(Out, MCInstBuilder(X86::POP32r).addReg(Reg)); in RestoreReg()
520 void StoreFlags(MCStreamer &Out) { in StoreFlags() argument
521 EmitInstruction(Out, MCInstBuilder(X86::PUSHF32)); in StoreFlags()
525 void RestoreFlags(MCStreamer &Out) { in RestoreFlags() argument
526 EmitInstruction(Out, MCInstBuilder(X86::POPF32)); in RestoreFlags()
532 MCStreamer &Out) override { in InstrumentMemOperandPrologue() argument
537 unsigned FrameReg = GetFrameReg(Ctx, Out); in InstrumentMemOperandPrologue()
539 SpillReg(Out, LocalFrameReg); in InstrumentMemOperandPrologue()
541 Out.EmitCFIAdjustCfaOffset(4 /* byte size of the LocalFrameReg */); in InstrumentMemOperandPrologue()
542 Out.EmitCFIRelOffset( in InstrumentMemOperandPrologue()
546 Out, in InstrumentMemOperandPrologue()
548 Out.EmitCFIRememberState(); in InstrumentMemOperandPrologue()
549 Out.EmitCFIDefCfaRegister( in InstrumentMemOperandPrologue()
553 SpillReg(Out, RegCtx.AddressReg(32)); in InstrumentMemOperandPrologue()
554 SpillReg(Out, RegCtx.ShadowReg(32)); in InstrumentMemOperandPrologue()
556 SpillReg(Out, RegCtx.ScratchReg(32)); in InstrumentMemOperandPrologue()
557 StoreFlags(Out); in InstrumentMemOperandPrologue()
562 MCStreamer &Out) override { in InstrumentMemOperandEpilogue() argument
566 RestoreFlags(Out); in InstrumentMemOperandEpilogue()
568 RestoreReg(Out, RegCtx.ScratchReg(32)); in InstrumentMemOperandEpilogue()
569 RestoreReg(Out, RegCtx.ShadowReg(32)); in InstrumentMemOperandEpilogue()
570 RestoreReg(Out, RegCtx.AddressReg(32)); in InstrumentMemOperandEpilogue()
572 unsigned FrameReg = GetFrameReg(Ctx, Out); in InstrumentMemOperandEpilogue()
574 RestoreReg(Out, LocalFrameReg); in InstrumentMemOperandEpilogue()
575 Out.EmitCFIRestoreState(); in InstrumentMemOperandEpilogue()
577 Out.EmitCFIAdjustCfaOffset(-4 /* byte size of the LocalFrameReg */); in InstrumentMemOperandEpilogue()
585 MCStreamer &Out) override;
590 MCStreamer &Out) override;
592 MCStreamer &Out) override;
596 MCStreamer &Out, const RegisterContext &RegCtx) { in EmitCallAsanReport() argument
597 EmitInstruction(Out, MCInstBuilder(X86::CLD)); in EmitCallAsanReport()
598 EmitInstruction(Out, MCInstBuilder(X86::MMX_EMMS)); in EmitCallAsanReport()
600 EmitInstruction(Out, MCInstBuilder(X86::AND64ri8) in EmitCallAsanReport()
605 Out, MCInstBuilder(X86::PUSH32r).addReg(RegCtx.AddressReg(32))); in EmitCallAsanReport()
612 EmitInstruction(Out, MCInstBuilder(X86::CALLpcrel32).addExpr(FnExpr)); in EmitCallAsanReport()
618 const RegisterContext &RegCtx, MCContext &Ctx, MCStreamer &Out) { in InstrumentMemOperandSmall() argument
626 ComputeMemOperandAddress(Op, 32, AddressRegI32, Ctx, Out); in InstrumentMemOperandSmall()
628 EmitInstruction(Out, MCInstBuilder(X86::MOV32rr).addReg(ShadowRegI32).addReg( in InstrumentMemOperandSmall()
630 EmitInstruction(Out, MCInstBuilder(X86::SHR32ri) in InstrumentMemOperandSmall()
644 EmitInstruction(Out, Inst); in InstrumentMemOperandSmall()
648 Out, MCInstBuilder(X86::TEST8rr).addReg(ShadowRegI8).addReg(ShadowRegI8)); in InstrumentMemOperandSmall()
651 EmitInstruction(Out, MCInstBuilder(X86::JE_1).addExpr(DoneExpr)); in InstrumentMemOperandSmall()
653 EmitInstruction(Out, MCInstBuilder(X86::MOV32rr).addReg(ScratchRegI32).addReg( in InstrumentMemOperandSmall()
655 EmitInstruction(Out, MCInstBuilder(X86::AND32ri) in InstrumentMemOperandSmall()
669 EmitLEA(*Op, 32, ScratchRegI32, Out); in InstrumentMemOperandSmall()
673 EmitInstruction(Out, MCInstBuilder(X86::ADD32ri8) in InstrumentMemOperandSmall()
681 Out, in InstrumentMemOperandSmall()
683 EmitInstruction(Out, MCInstBuilder(X86::CMP32rr).addReg(ScratchRegI32).addReg( in InstrumentMemOperandSmall()
685 EmitInstruction(Out, MCInstBuilder(X86::JL_1).addExpr(DoneExpr)); in InstrumentMemOperandSmall()
687 EmitCallAsanReport(AccessSize, IsWrite, Ctx, Out, RegCtx); in InstrumentMemOperandSmall()
688 EmitLabel(Out, DoneSym); in InstrumentMemOperandSmall()
693 const RegisterContext &RegCtx, MCContext &Ctx, MCStreamer &Out) { in InstrumentMemOperandLarge() argument
697 ComputeMemOperandAddress(Op, 32, AddressRegI32, Ctx, Out); in InstrumentMemOperandLarge()
699 EmitInstruction(Out, MCInstBuilder(X86::MOV32rr).addReg(ShadowRegI32).addReg( in InstrumentMemOperandLarge()
701 EmitInstruction(Out, MCInstBuilder(X86::SHR32ri) in InstrumentMemOperandLarge()
722 EmitInstruction(Out, Inst); in InstrumentMemOperandLarge()
726 EmitInstruction(Out, MCInstBuilder(X86::JE_1).addExpr(DoneExpr)); in InstrumentMemOperandLarge()
728 EmitCallAsanReport(AccessSize, IsWrite, Ctx, Out, RegCtx); in InstrumentMemOperandLarge()
729 EmitLabel(Out, DoneSym); in InstrumentMemOperandLarge()
734 MCStreamer &Out) { in InstrumentMOVSImpl() argument
735 StoreFlags(Out); in InstrumentMOVSImpl()
741 Out, MCInstBuilder(X86::TEST32rr).addReg(X86::ECX).addReg(X86::ECX)); in InstrumentMOVSImpl()
742 EmitInstruction(Out, MCInstBuilder(X86::JE_1).addExpr(DoneExpr)); in InstrumentMOVSImpl()
746 X86::ECX /* CntReg */, AccessSize, Ctx, Out); in InstrumentMOVSImpl()
748 EmitLabel(Out, DoneSym); in InstrumentMOVSImpl()
749 RestoreFlags(Out); in InstrumentMOVSImpl()
761 unsigned GetFrameReg(const MCContext &Ctx, MCStreamer &Out) { in GetFrameReg() argument
762 unsigned FrameReg = GetFrameRegGeneric(Ctx, Out); in GetFrameReg()
768 void SpillReg(MCStreamer &Out, unsigned Reg) { in SpillReg() argument
769 EmitInstruction(Out, MCInstBuilder(X86::PUSH64r).addReg(Reg)); in SpillReg()
773 void RestoreReg(MCStreamer &Out, unsigned Reg) { in RestoreReg() argument
774 EmitInstruction(Out, MCInstBuilder(X86::POP64r).addReg(Reg)); in RestoreReg()
778 void StoreFlags(MCStreamer &Out) { in StoreFlags() argument
779 EmitInstruction(Out, MCInstBuilder(X86::PUSHF64)); in StoreFlags()
783 void RestoreFlags(MCStreamer &Out) { in RestoreFlags() argument
784 EmitInstruction(Out, MCInstBuilder(X86::POPF64)); in RestoreFlags()
790 MCStreamer &Out) override { in InstrumentMemOperandPrologue() argument
795 unsigned FrameReg = GetFrameReg(Ctx, Out); in InstrumentMemOperandPrologue()
797 SpillReg(Out, X86::RBP); in InstrumentMemOperandPrologue()
799 Out.EmitCFIAdjustCfaOffset(8 /* byte size of the LocalFrameReg */); in InstrumentMemOperandPrologue()
800 Out.EmitCFIRelOffset( in InstrumentMemOperandPrologue()
804 Out, in InstrumentMemOperandPrologue()
806 Out.EmitCFIRememberState(); in InstrumentMemOperandPrologue()
807 Out.EmitCFIDefCfaRegister( in InstrumentMemOperandPrologue()
811 EmitAdjustRSP(Ctx, Out, -128); in InstrumentMemOperandPrologue()
812 SpillReg(Out, RegCtx.ShadowReg(64)); in InstrumentMemOperandPrologue()
813 SpillReg(Out, RegCtx.AddressReg(64)); in InstrumentMemOperandPrologue()
815 SpillReg(Out, RegCtx.ScratchReg(64)); in InstrumentMemOperandPrologue()
816 StoreFlags(Out); in InstrumentMemOperandPrologue()
821 MCStreamer &Out) override { in InstrumentMemOperandEpilogue() argument
825 RestoreFlags(Out); in InstrumentMemOperandEpilogue()
827 RestoreReg(Out, RegCtx.ScratchReg(64)); in InstrumentMemOperandEpilogue()
828 RestoreReg(Out, RegCtx.AddressReg(64)); in InstrumentMemOperandEpilogue()
829 RestoreReg(Out, RegCtx.ShadowReg(64)); in InstrumentMemOperandEpilogue()
830 EmitAdjustRSP(Ctx, Out, 128); in InstrumentMemOperandEpilogue()
832 unsigned FrameReg = GetFrameReg(Ctx, Out); in InstrumentMemOperandEpilogue()
834 RestoreReg(Out, LocalFrameReg); in InstrumentMemOperandEpilogue()
835 Out.EmitCFIRestoreState(); in InstrumentMemOperandEpilogue()
837 Out.EmitCFIAdjustCfaOffset(-8 /* byte size of the LocalFrameReg */); in InstrumentMemOperandEpilogue()
845 MCStreamer &Out) override;
850 MCStreamer &Out) override;
852 MCStreamer &Out) override;
855 void EmitAdjustRSP(MCContext &Ctx, MCStreamer &Out, long Offset) { in EmitAdjustRSP() argument
860 EmitLEA(*Op, 64, X86::RSP, Out); in EmitAdjustRSP()
865 MCStreamer &Out, const RegisterContext &RegCtx) { in EmitCallAsanReport() argument
866 EmitInstruction(Out, MCInstBuilder(X86::CLD)); in EmitCallAsanReport()
867 EmitInstruction(Out, MCInstBuilder(X86::MMX_EMMS)); in EmitCallAsanReport()
869 EmitInstruction(Out, MCInstBuilder(X86::AND64ri8) in EmitCallAsanReport()
875 EmitInstruction(Out, MCInstBuilder(X86::MOV64rr).addReg(X86::RDI).addReg( in EmitCallAsanReport()
883 EmitInstruction(Out, MCInstBuilder(X86::CALL64pcrel32).addExpr(FnExpr)); in EmitCallAsanReport()
889 const RegisterContext &RegCtx, MCContext &Ctx, MCStreamer &Out) { in InstrumentMemOperandSmall() argument
899 ComputeMemOperandAddress(Op, 64, AddressRegI64, Ctx, Out); in InstrumentMemOperandSmall()
901 EmitInstruction(Out, MCInstBuilder(X86::MOV64rr).addReg(ShadowRegI64).addReg( in InstrumentMemOperandSmall()
903 EmitInstruction(Out, MCInstBuilder(X86::SHR64ri) in InstrumentMemOperandSmall()
916 EmitInstruction(Out, Inst); in InstrumentMemOperandSmall()
920 Out, MCInstBuilder(X86::TEST8rr).addReg(ShadowRegI8).addReg(ShadowRegI8)); in InstrumentMemOperandSmall()
923 EmitInstruction(Out, MCInstBuilder(X86::JE_1).addExpr(DoneExpr)); in InstrumentMemOperandSmall()
925 EmitInstruction(Out, MCInstBuilder(X86::MOV32rr).addReg(ScratchRegI32).addReg( in InstrumentMemOperandSmall()
927 EmitInstruction(Out, MCInstBuilder(X86::AND32ri) in InstrumentMemOperandSmall()
941 EmitLEA(*Op, 32, ScratchRegI32, Out); in InstrumentMemOperandSmall()
945 EmitInstruction(Out, MCInstBuilder(X86::ADD32ri8) in InstrumentMemOperandSmall()
953 Out, in InstrumentMemOperandSmall()
955 EmitInstruction(Out, MCInstBuilder(X86::CMP32rr).addReg(ScratchRegI32).addReg( in InstrumentMemOperandSmall()
957 EmitInstruction(Out, MCInstBuilder(X86::JL_1).addExpr(DoneExpr)); in InstrumentMemOperandSmall()
959 EmitCallAsanReport(AccessSize, IsWrite, Ctx, Out, RegCtx); in InstrumentMemOperandSmall()
960 EmitLabel(Out, DoneSym); in InstrumentMemOperandSmall()
965 const RegisterContext &RegCtx, MCContext &Ctx, MCStreamer &Out) { in InstrumentMemOperandLarge() argument
969 ComputeMemOperandAddress(Op, 64, AddressRegI64, Ctx, Out); in InstrumentMemOperandLarge()
971 EmitInstruction(Out, MCInstBuilder(X86::MOV64rr).addReg(ShadowRegI64).addReg( in InstrumentMemOperandLarge()
973 EmitInstruction(Out, MCInstBuilder(X86::SHR64ri) in InstrumentMemOperandLarge()
994 EmitInstruction(Out, Inst); in InstrumentMemOperandLarge()
999 EmitInstruction(Out, MCInstBuilder(X86::JE_1).addExpr(DoneExpr)); in InstrumentMemOperandLarge()
1001 EmitCallAsanReport(AccessSize, IsWrite, Ctx, Out, RegCtx); in InstrumentMemOperandLarge()
1002 EmitLabel(Out, DoneSym); in InstrumentMemOperandLarge()
1007 MCStreamer &Out) { in InstrumentMOVSImpl() argument
1008 StoreFlags(Out); in InstrumentMOVSImpl()
1014 Out, MCInstBuilder(X86::TEST64rr).addReg(X86::RCX).addReg(X86::RCX)); in InstrumentMOVSImpl()
1015 EmitInstruction(Out, MCInstBuilder(X86::JE_1).addExpr(DoneExpr)); in InstrumentMOVSImpl()
1019 X86::RCX /* CntReg */, AccessSize, Ctx, Out); in InstrumentMOVSImpl()
1021 EmitLabel(Out, DoneSym); in InstrumentMOVSImpl()
1022 RestoreFlags(Out); in InstrumentMOVSImpl()
1034 const MCInstrInfo &MII, MCStreamer &Out) { in InstrumentAndEmitInstruction() argument
1035 EmitInstruction(Out, Inst); in InstrumentAndEmitInstruction()
1038 void X86AsmInstrumentation::EmitInstruction(MCStreamer &Out, in EmitInstruction() argument
1040 Out.EmitInstruction(Inst, *STI); in EmitInstruction()
1044 MCStreamer &Out) { in GetFrameRegGeneric() argument
1045 if (!Out.getNumFrameInfos()) // No active dwarf frame in GetFrameRegGeneric()
1047 const MCDwarfFrameInfo &Frame = Out.getDwarfFrameInfos().back(); in GetFrameRegGeneric()