101 using namespace llvm;
104 "asan-instrument-assembly",
124 return Reg == X86::RSP || Reg == X86::ESP;
133 struct RegisterContext {
136 REG_OFFSET_ADDRESS = 0,
142 RegisterContext(
unsigned AddressReg,
unsigned ShadowReg,
143 unsigned ScratchReg) {
144 BusyRegs.push_back(convReg(AddressReg, 64));
145 BusyRegs.push_back(convReg(ShadowReg, 64));
146 BusyRegs.push_back(convReg(ScratchReg, 64));
149 unsigned AddressReg(
unsigned Size)
const {
150 return convReg(BusyRegs[REG_OFFSET_ADDRESS], Size);
153 unsigned ShadowReg(
unsigned Size)
const {
154 return convReg(BusyRegs[REG_OFFSET_SHADOW], Size);
157 unsigned ScratchReg(
unsigned Size)
const {
158 return convReg(BusyRegs[REG_OFFSET_SCRATCH], Size);
161 void AddBusyReg(
unsigned Reg) {
162 if (Reg != X86::NoRegister)
163 BusyRegs.push_back(convReg(Reg, 64));
171 unsigned ChooseFrameReg(
unsigned Size)
const {
172 static const MCPhysReg Candidates[] = { X86::RBP, X86::RAX, X86::RBX,
173 X86::RCX, X86::RDX, X86::RDI,
175 for (
unsigned Reg : Candidates) {
177 return convReg(Reg, Size);
179 return X86::NoRegister;
183 unsigned convReg(
unsigned Reg,
unsigned Size)
const {
187 std::vector<unsigned> BusyRegs;
193 ~X86AddressSanitizer()
override =
default;
196 void InstrumentAndEmitInstruction(
const MCInst &Inst,
201 InstrumentMOVS(Inst, Operands, Ctx, MII, Out);
205 InstrumentMOV(Inst, Operands, Ctx, MII, Out);
207 RepPrefix = (Inst.
getOpcode() == X86::REP_PREFIX);
209 EmitInstruction(Out, Inst);
213 virtual void InstrumentMemOperandPrologue(
const RegisterContext &RegCtx,
218 virtual void InstrumentMemOperandEpilogue(
const RegisterContext &RegCtx,
222 virtual void InstrumentMemOperandSmall(
X86Operand &Op,
unsigned AccessSize,
224 const RegisterContext &RegCtx,
226 virtual void InstrumentMemOperandLarge(
X86Operand &Op,
unsigned AccessSize,
228 const RegisterContext &RegCtx,
231 virtual void InstrumentMOVSImpl(
unsigned AccessSize,
MCContext &Ctx,
234 void InstrumentMemOperand(
X86Operand &Op,
unsigned AccessSize,
bool IsWrite,
235 const RegisterContext &RegCtx,
MCContext &Ctx,
237 void InstrumentMOVSBase(
unsigned DstReg,
unsigned SrcReg,
unsigned CntReg,
249 assert(Size == 32 || Size == 64);
251 Inst.
setOpcode(Size == 32 ? X86::LEA32r : X86::LEA64r);
254 EmitInstruction(Out, Inst);
257 void ComputeMemOperandAddress(
X86Operand &Op,
unsigned Size,
263 std::unique_ptr<X86Operand> AddDisplacement(
X86Operand &Op,
264 int64_t Displacement,
267 bool is64BitMode()
const {
268 return STI->getFeatureBits()[X86::Mode64Bit];
271 bool is32BitMode()
const {
272 return STI->getFeatureBits()[X86::Mode32Bit];
275 bool is16BitMode()
const {
276 return STI->getFeatureBits()[X86::Mode16Bit];
279 unsigned getPointerWidth() {
280 if (is16BitMode())
return 16;
281 if (is32BitMode())
return 32;
282 if (is64BitMode())
return 64;
290 int64_t OrigSPOffset;
293 void X86AddressSanitizer::InstrumentMemOperand(
294 X86Operand &Op,
unsigned AccessSize,
bool IsWrite,
296 assert(Op.
isMem() &&
"Op should be a memory operand.");
297 assert((AccessSize & (AccessSize - 1)) == 0 && AccessSize <= 16 &&
298 "AccessSize should be a power of two, less or equal than 16.");
301 InstrumentMemOperandSmall(Op, AccessSize, IsWrite, RegCtx, Ctx, Out);
303 InstrumentMemOperandLarge(Op, AccessSize, IsWrite, RegCtx, Ctx, Out);
306 void X86AddressSanitizer::InstrumentMOVSBase(
unsigned DstReg,
unsigned SrcReg,
312 RegisterContext RegCtx(X86::RDX , X86::RAX ,
316 RegCtx.AddBusyReg(DstReg);
317 RegCtx.AddBusyReg(SrcReg);
318 RegCtx.AddBusyReg(CntReg);
320 InstrumentMemOperandPrologue(RegCtx, Ctx, Out);
326 getPointerWidth(), 0, Disp, SrcReg, 0, AccessSize,
SMLoc(),
SMLoc()));
327 InstrumentMemOperand(*Op, AccessSize,
false , RegCtx, Ctx,
335 getPointerWidth(), 0, Disp, SrcReg, CntReg, AccessSize,
SMLoc(),
337 InstrumentMemOperand(*Op, AccessSize,
false , RegCtx, Ctx,
345 getPointerWidth(), 0, Disp, DstReg, 0, AccessSize,
SMLoc(),
SMLoc()));
346 InstrumentMemOperand(*Op, AccessSize,
true , RegCtx, Ctx, Out);
353 getPointerWidth(), 0, Disp, DstReg, CntReg, AccessSize,
SMLoc(),
355 InstrumentMemOperand(*Op, AccessSize,
true , RegCtx, Ctx, Out);
358 InstrumentMemOperandEpilogue(RegCtx, Ctx, Out);
361 void X86AddressSanitizer::InstrumentMOVS(
const MCInst &Inst,
366 unsigned AccessSize = 0;
385 InstrumentMOVSImpl(AccessSize, Ctx, Out);
388 void X86AddressSanitizer::InstrumentMOV(
const MCInst &Inst,
393 unsigned AccessSize = 0;
426 const bool IsWrite = MII.
get(Inst.
getOpcode()).mayStore();
428 for (
unsigned Ix = 0; Ix < Operands.
size(); ++Ix) {
433 RegisterContext RegCtx(
434 X86::RDI , X86::RAX ,
437 RegCtx.AddBusyRegs(MemOp);
438 InstrumentMemOperandPrologue(RegCtx, Ctx, Out);
439 InstrumentMemOperand(MemOp, AccessSize, IsWrite, RegCtx, Ctx, Out);
440 InstrumentMemOperandEpilogue(RegCtx, Ctx, Out);
445 void X86AddressSanitizer::ComputeMemOperandAddress(
X86Operand &Op,
449 int64_t Displacement = 0;
451 Displacement -= OrigSPOffset;
455 assert(Displacement >= 0);
458 if (Displacement == 0) {
459 EmitLEA(Op, Size, Reg, Out);
464 std::unique_ptr<X86Operand> NewOp =
465 AddDisplacement(Op, Displacement, Ctx, &Residue);
466 EmitLEA(*NewOp, Size, Reg, Out);
468 while (Residue != 0) {
471 std::unique_ptr<X86Operand> DispOp =
474 EmitLEA(*DispOp, Size, Reg, Out);
479 std::unique_ptr<X86Operand>
480 X86AddressSanitizer::AddDisplacement(
X86Operand &Op, int64_t Displacement,
482 assert(Displacement >= 0);
484 if (Displacement == 0 ||
486 *Residue = Displacement;
493 int64_t OrigDisplacement =
496 Displacement += OrigDisplacement;
501 *Residue = Displacement - NewDisplacement;
508 class X86AddressSanitizer32 :
public X86AddressSanitizer {
510 static const long kShadowOffset = 0x20000000;
513 : X86AddressSanitizer(STI) {}
515 ~X86AddressSanitizer32()
override =
default;
518 unsigned FrameReg = GetFrameRegGeneric(Ctx, Out);
519 if (FrameReg == X86::NoRegister)
524 void SpillReg(
MCStreamer &Out,
unsigned Reg) {
525 EmitInstruction(Out,
MCInstBuilder(X86::PUSH32r).addReg(Reg));
529 void RestoreReg(
MCStreamer &Out,
unsigned Reg) {
530 EmitInstruction(Out,
MCInstBuilder(X86::POP32r).addReg(Reg));
544 void InstrumentMemOperandPrologue(
const RegisterContext &RegCtx,
547 unsigned LocalFrameReg = RegCtx.ChooseFrameReg(32);
548 assert(LocalFrameReg != X86::NoRegister);
551 unsigned FrameReg = GetFrameReg(Ctx, Out);
552 if (MRI && FrameReg != X86::NoRegister) {
553 SpillReg(Out, LocalFrameReg);
554 if (FrameReg == X86::ESP) {
561 MCInstBuilder(X86::MOV32rr).addReg(LocalFrameReg).addReg(FrameReg));
567 SpillReg(Out, RegCtx.AddressReg(32));
568 SpillReg(Out, RegCtx.ShadowReg(32));
569 if (RegCtx.ScratchReg(32) != X86::NoRegister)
570 SpillReg(Out, RegCtx.ScratchReg(32));
574 void InstrumentMemOperandEpilogue(
const RegisterContext &RegCtx,
577 unsigned LocalFrameReg = RegCtx.ChooseFrameReg(32);
578 assert(LocalFrameReg != X86::NoRegister);
581 if (RegCtx.ScratchReg(32) != X86::NoRegister)
582 RestoreReg(Out, RegCtx.ScratchReg(32));
583 RestoreReg(Out, RegCtx.ShadowReg(32));
584 RestoreReg(Out, RegCtx.AddressReg(32));
586 unsigned FrameReg = GetFrameReg(Ctx, Out);
588 RestoreReg(Out, LocalFrameReg);
590 if (FrameReg == X86::ESP)
595 void InstrumentMemOperandSmall(
X86Operand &Op,
unsigned AccessSize,
597 const RegisterContext &RegCtx,
600 void InstrumentMemOperandLarge(
X86Operand &Op,
unsigned AccessSize,
602 const RegisterContext &RegCtx,
605 void InstrumentMOVSImpl(
unsigned AccessSize,
MCContext &Ctx,
609 void EmitCallAsanReport(
unsigned AccessSize,
bool IsWrite,
MCContext &Ctx,
610 MCStreamer &Out,
const RegisterContext &RegCtx) {
619 Out,
MCInstBuilder(X86::PUSH32r).addReg(RegCtx.AddressReg(32)));
622 (IsWrite ?
"store" :
"load") +
626 EmitInstruction(Out,
MCInstBuilder(X86::CALLpcrel32).addExpr(FnExpr));
630 void X86AddressSanitizer32::InstrumentMemOperandSmall(
631 X86Operand &Op,
unsigned AccessSize,
bool IsWrite,
633 unsigned AddressRegI32 = RegCtx.AddressReg(32);
634 unsigned ShadowRegI32 = RegCtx.ShadowReg(32);
635 unsigned ShadowRegI8 = RegCtx.ShadowReg(8);
637 assert(RegCtx.ScratchReg(32) != X86::NoRegister);
638 unsigned ScratchRegI32 = RegCtx.ScratchReg(32);
640 ComputeMemOperandAddress(Op, 32, AddressRegI32, Ctx, Out);
642 EmitInstruction(Out,
MCInstBuilder(X86::MOV32rr).addReg(ShadowRegI32).addReg(
645 .addReg(ShadowRegI32)
646 .addReg(ShadowRegI32)
654 std::unique_ptr<X86Operand>
Op(
658 EmitInstruction(Out, Inst);
662 Out,
MCInstBuilder(X86::TEST8rr).addReg(ShadowRegI8).addReg(ShadowRegI8));
665 EmitInstruction(Out,
MCInstBuilder(X86::JE_1).addExpr(DoneExpr));
667 EmitInstruction(Out,
MCInstBuilder(X86::MOV32rr).addReg(ScratchRegI32).addReg(
670 .addReg(ScratchRegI32)
671 .addReg(ScratchRegI32)
674 switch (AccessSize) {
680 std::unique_ptr<X86Operand>
Op(
683 EmitLEA(*Op, 32, ScratchRegI32, Out);
688 .addReg(ScratchRegI32)
689 .addReg(ScratchRegI32)
696 MCInstBuilder(X86::MOVSX32rr8).addReg(ShadowRegI32).addReg(ShadowRegI8));
697 EmitInstruction(Out,
MCInstBuilder(X86::CMP32rr).addReg(ScratchRegI32).addReg(
699 EmitInstruction(Out,
MCInstBuilder(X86::JL_1).addExpr(DoneExpr));
701 EmitCallAsanReport(AccessSize, IsWrite, Ctx, Out, RegCtx);
702 EmitLabel(Out, DoneSym);
705 void X86AddressSanitizer32::InstrumentMemOperandLarge(
706 X86Operand &Op,
unsigned AccessSize,
bool IsWrite,
708 unsigned AddressRegI32 = RegCtx.AddressReg(32);
709 unsigned ShadowRegI32 = RegCtx.ShadowReg(32);
711 ComputeMemOperandAddress(Op, 32, AddressRegI32, Ctx, Out);
713 EmitInstruction(Out,
MCInstBuilder(X86::MOV32rr).addReg(ShadowRegI32).addReg(
716 .addReg(ShadowRegI32)
717 .addReg(ShadowRegI32)
721 switch (AccessSize) {
731 std::unique_ptr<X86Operand>
Op(
736 EmitInstruction(Out, Inst);
740 EmitInstruction(Out,
MCInstBuilder(X86::JE_1).addExpr(DoneExpr));
742 EmitCallAsanReport(AccessSize, IsWrite, Ctx, Out, RegCtx);
743 EmitLabel(Out, DoneSym);
746 void X86AddressSanitizer32::InstrumentMOVSImpl(
unsigned AccessSize,
755 Out,
MCInstBuilder(X86::TEST32rr).addReg(X86::ECX).addReg(X86::ECX));
756 EmitInstruction(Out,
MCInstBuilder(X86::JE_1).addExpr(DoneExpr));
759 InstrumentMOVSBase(X86::EDI , X86::ESI ,
760 X86::ECX , AccessSize, Ctx, Out);
762 EmitLabel(Out, DoneSym);
766 class X86AddressSanitizer64 :
public X86AddressSanitizer {
768 static const long kShadowOffset = 0x7fff8000;
771 : X86AddressSanitizer(STI) {}
773 ~X86AddressSanitizer64()
override =
default;
776 unsigned FrameReg = GetFrameRegGeneric(Ctx, Out);
777 if (FrameReg == X86::NoRegister)
782 void SpillReg(
MCStreamer &Out,
unsigned Reg) {
783 EmitInstruction(Out,
MCInstBuilder(X86::PUSH64r).addReg(Reg));
787 void RestoreReg(
MCStreamer &Out,
unsigned Reg) {
788 EmitInstruction(Out,
MCInstBuilder(X86::POP64r).addReg(Reg));
802 void InstrumentMemOperandPrologue(
const RegisterContext &RegCtx,
805 unsigned LocalFrameReg = RegCtx.ChooseFrameReg(64);
806 assert(LocalFrameReg != X86::NoRegister);
809 unsigned FrameReg = GetFrameReg(Ctx, Out);
810 if (MRI && FrameReg != X86::NoRegister) {
811 SpillReg(Out, X86::RBP);
812 if (FrameReg == X86::RSP) {
819 MCInstBuilder(X86::MOV64rr).addReg(LocalFrameReg).addReg(FrameReg));
825 EmitAdjustRSP(Ctx, Out, -128);
826 SpillReg(Out, RegCtx.ShadowReg(64));
827 SpillReg(Out, RegCtx.AddressReg(64));
828 if (RegCtx.ScratchReg(64) != X86::NoRegister)
829 SpillReg(Out, RegCtx.ScratchReg(64));
833 void InstrumentMemOperandEpilogue(
const RegisterContext &RegCtx,
836 unsigned LocalFrameReg = RegCtx.ChooseFrameReg(64);
837 assert(LocalFrameReg != X86::NoRegister);
840 if (RegCtx.ScratchReg(64) != X86::NoRegister)
841 RestoreReg(Out, RegCtx.ScratchReg(64));
842 RestoreReg(Out, RegCtx.AddressReg(64));
843 RestoreReg(Out, RegCtx.ShadowReg(64));
844 EmitAdjustRSP(Ctx, Out, 128);
846 unsigned FrameReg = GetFrameReg(Ctx, Out);
848 RestoreReg(Out, LocalFrameReg);
850 if (FrameReg == X86::RSP)
855 void InstrumentMemOperandSmall(
X86Operand &Op,
unsigned AccessSize,
857 const RegisterContext &RegCtx,
860 void InstrumentMemOperandLarge(
X86Operand &Op,
unsigned AccessSize,
862 const RegisterContext &RegCtx,
865 void InstrumentMOVSImpl(
unsigned AccessSize,
MCContext &Ctx,
871 std::unique_ptr<X86Operand>
Op(
874 EmitLEA(*Op, 64, X86::RSP, Out);
878 void EmitCallAsanReport(
unsigned AccessSize,
bool IsWrite,
MCContext &Ctx,
879 MCStreamer &Out,
const RegisterContext &RegCtx) {
888 if (RegCtx.AddressReg(64) != X86::RDI) {
889 EmitInstruction(Out,
MCInstBuilder(X86::MOV64rr).addReg(X86::RDI).addReg(
890 RegCtx.AddressReg(64)));
893 (IsWrite ?
"store" :
"load") +
897 EmitInstruction(Out,
MCInstBuilder(X86::CALL64pcrel32).addExpr(FnExpr));
903 void X86AddressSanitizer64::InstrumentMemOperandSmall(
904 X86Operand &Op,
unsigned AccessSize,
bool IsWrite,
906 unsigned AddressRegI64 = RegCtx.AddressReg(64);
907 unsigned AddressRegI32 = RegCtx.AddressReg(32);
908 unsigned ShadowRegI64 = RegCtx.ShadowReg(64);
909 unsigned ShadowRegI32 = RegCtx.ShadowReg(32);
910 unsigned ShadowRegI8 = RegCtx.ShadowReg(8);
912 assert(RegCtx.ScratchReg(32) != X86::NoRegister);
913 unsigned ScratchRegI32 = RegCtx.ScratchReg(32);
915 ComputeMemOperandAddress(Op, 64, AddressRegI64, Ctx, Out);
917 EmitInstruction(Out,
MCInstBuilder(X86::MOV64rr).addReg(ShadowRegI64).addReg(
920 .addReg(ShadowRegI64)
921 .addReg(ShadowRegI64)
928 std::unique_ptr<X86Operand>
Op(
932 EmitInstruction(Out, Inst);
936 Out,
MCInstBuilder(X86::TEST8rr).addReg(ShadowRegI8).addReg(ShadowRegI8));
939 EmitInstruction(Out,
MCInstBuilder(X86::JE_1).addExpr(DoneExpr));
941 EmitInstruction(Out,
MCInstBuilder(X86::MOV32rr).addReg(ScratchRegI32).addReg(
944 .addReg(ScratchRegI32)
945 .addReg(ScratchRegI32)
948 switch (AccessSize) {
954 std::unique_ptr<X86Operand>
Op(
957 EmitLEA(*Op, 32, ScratchRegI32, Out);
962 .addReg(ScratchRegI32)
963 .addReg(ScratchRegI32)
970 MCInstBuilder(X86::MOVSX32rr8).addReg(ShadowRegI32).addReg(ShadowRegI8));
971 EmitInstruction(Out,
MCInstBuilder(X86::CMP32rr).addReg(ScratchRegI32).addReg(
973 EmitInstruction(Out,
MCInstBuilder(X86::JL_1).addExpr(DoneExpr));
975 EmitCallAsanReport(AccessSize, IsWrite, Ctx, Out, RegCtx);
976 EmitLabel(Out, DoneSym);
979 void X86AddressSanitizer64::InstrumentMemOperandLarge(
980 X86Operand &Op,
unsigned AccessSize,
bool IsWrite,
982 unsigned AddressRegI64 = RegCtx.AddressReg(64);
983 unsigned ShadowRegI64 = RegCtx.ShadowReg(64);
985 ComputeMemOperandAddress(Op, 64, AddressRegI64, Ctx, Out);
987 EmitInstruction(Out,
MCInstBuilder(X86::MOV64rr).addReg(ShadowRegI64).addReg(
990 .addReg(ShadowRegI64)
991 .addReg(ShadowRegI64)
995 switch (AccessSize) {
1005 std::unique_ptr<X86Operand>
Op(
1010 EmitInstruction(Out, Inst);
1015 EmitInstruction(Out,
MCInstBuilder(X86::JE_1).addExpr(DoneExpr));
1017 EmitCallAsanReport(AccessSize, IsWrite, Ctx, Out, RegCtx);
1018 EmitLabel(Out, DoneSym);
1021 void X86AddressSanitizer64::InstrumentMOVSImpl(
unsigned AccessSize,
1030 Out,
MCInstBuilder(X86::TEST64rr).addReg(X86::RCX).addReg(X86::RCX));
1031 EmitInstruction(Out,
MCInstBuilder(X86::JE_1).addExpr(DoneExpr));
1034 InstrumentMOVSBase(X86::RDI , X86::RSI ,
1035 X86::RCX , AccessSize, Ctx, Out);
1037 EmitLabel(Out, DoneSym);
1060 return X86::NoRegister;
1063 return X86::NoRegister;
1066 return X86::NoRegister;
1081 const bool hasCompilerRTSupport =
T.isOSLinux();
1085 return new X86AddressSanitizer32(STI);
1087 return new X86AddressSanitizer64(STI);
int getDwarfRegNum(unsigned RegNum, bool isEH) const
Map a target register to an equivalent dwarf register number.
GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx)
static void CheckDisplacementBounds(int64_t Displacement)
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Maximum length of the test input libFuzzer tries to guess a good value based on the corpus and reports it always prefer smaller inputs during the corpus shuffle When libFuzzer itself reports a bug this exit code will be used If indicates the maximal total time in seconds to run the fuzzer minimizes the provided crash input Use with tries to cleanse the provided crash input to make it contain fewer original bytes Use with exact_artifact_path to specify the output Experimental Use value profile to guide fuzzing Number of jobs to run If min(jobs, NumberOfCpuCores()/2)\" is used.") FUZZER_FLAG_INT(reload
bool SanitizeAddress
Enables AddressSanitizer instrumentation at machine level.
unsigned getMemModeSize() const
unsigned CurrentCfaRegister
ArrayRef< MCDwarfFrameInfo > getDwarfFrameInfos() const
static std::unique_ptr< X86Operand > CreateMem(unsigned ModeSize, const MCExpr *Disp, SMLoc StartLoc, SMLoc EndLoc, unsigned Size=0, StringRef SymName=StringRef(), void *OpDecl=nullptr, unsigned FrontendSize=0)
Create an absolute memory operand.
virtual bool isMem() const =0
isMem - Is this a memory operand?
unsigned getMemScale() const
virtual void EmitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI, bool PrintSchedInfo=false)
Emit the given Instruction into the current section.
virtual void EmitCFIRememberState()
virtual void InstrumentAndEmitInstruction(const MCInst &Inst, SmallVectorImpl< std::unique_ptr< MCParsedAsmOperand >> &Operands, MCContext &Ctx, const MCInstrInfo &MII, MCStreamer &Out)
static MCOperand createReg(unsigned Reg)
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
static const int64_t MinAllowedDisplacement
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Base class for the full range of assembler expressions which are needed for parsing.
Reg
All possible values of the reg field in the ModR/M byte.
Represent a reference to a symbol from inside an expression.
MCParsedAsmOperand - This abstract class represents a source-level assembly instruction operand...
Context object for machine code objects.
const MCExpr * getMemDisp() const
auto count(R &&Range, const E &Element) -> typename std::iterator_traits< decltype(std::begin(Range))>::difference_type
Wrapper function around std::count to count the number of times an element Element occurs in the give...
virtual void EmitCFIRestoreState()
X86AsmInstrumentation(const MCSubtargetInfo *&STI)
Instances of this class represent a single low-level machine instruction.
uint16_t MCPhysReg
An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
Function Alias Analysis false
initializer< Ty > init(const Ty &Val)
static int64_t ApplyDisplacementBounds(int64_t Displacement)
Streaming machine code generation interface.
MCSymbol * createTempSymbol(bool CanBeUnnamed=true)
Create and return a new assembler temporary symbol with a unique but unspecified name.
unsigned const MachineRegisterInfo * MRI
X86Operand - Instances of this class represent a parsed X86 machine instruction.
Interface to description of machine instruction set.
virtual void EmitCFIDefCfaRegister(int64_t Register)
int getLLVMRegNum(unsigned RegNum, bool isEH) const
Map a dwarf register back to a target register.
const MCInstrDesc & get(unsigned Opcode) const
Return the machine instruction descriptor that corresponds to the specified instruction opcode...
Triple - Helper class for working with autoconf configuration names.
unsigned getMemSegReg() const
unsigned GetFrameRegGeneric(const MCContext &Ctx, MCStreamer &Out)
X86AsmInstrumentation * CreateX86AsmInstrumentation(const MCTargetOptions &MCOptions, const MCContext &Ctx, const MCSubtargetInfo *&STI)
static bool IsStackReg(unsigned Reg)
void setOpcode(unsigned Op)
static cl::opt< bool > ClAsanInstrumentAssembly("asan-instrument-assembly", cl::desc("instrument assembly with AddressSanitizer checks"), cl::Hidden, cl::init(false))
const FeatureBitset & getFeatureBits() const
getFeatureBits - Return the feature bits.
unsigned getX86SubSuperRegister(unsigned, unsigned, bool High=false)
Returns the sub or super register of a specific X86 register.
unsigned getOpcode() const
static bool IsSmallMemAccess(unsigned AccessSize)
unsigned getMemBaseReg() const
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
llvm_unreachable("Unknown RegBank!")
const MCRegisterInfo * getRegisterInfo() const
unsigned getNumFrameInfos()
MCSymbol * getOrCreateSymbol(const Twine &Name)
Lookup the symbol inside with the specified Name.
virtual void EmitCFIRelOffset(int64_t Register, int64_t Offset)
LLVM_ATTRIBUTE_ALWAYS_INLINE size_type size() const
MCSubtargetInfo - Generic base class for all target subtargets.
const Triple & getTargetTriple() const
getTargetTriple - Return the target triple string.
static const int64_t MaxAllowedDisplacement
const MCSubtargetInfo *& STI
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
virtual ~X86AsmInstrumentation()
virtual void EmitLabel(MCSymbol *Symbol, SMLoc Loc=SMLoc())
Emit a label for Symbol into the current section.
void addMemOperands(MCInst &Inst, unsigned N) const
void EmitInstruction(MCStreamer &Out, const MCInst &Inst)
void addOperand(const MCOperand &Op)
Represents a location in source code.
static MCOperand createImm(int64_t Val)
static const MCConstantExpr * create(int64_t Value, MCContext &Ctx)
virtual void EmitCFIAdjustCfaOffset(int64_t Adjustment)
unsigned getMemIndexReg() const
bool isMem() const override
isMem - Is this a memory operand?