class MCExpr;
class MCInst;
class MCInstPrinter;
+class MCRegister;
class MCSection;
class MCStreamer;
class MCSymbolRefExpr;
virtual void EmitWinCFIFuncletOrFuncEnd(SMLoc Loc = SMLoc());
virtual void EmitWinCFIStartChained(SMLoc Loc = SMLoc());
virtual void EmitWinCFIEndChained(SMLoc Loc = SMLoc());
- virtual void EmitWinCFIPushReg(unsigned Register, SMLoc Loc = SMLoc());
- virtual void EmitWinCFISetFrame(unsigned Register, unsigned Offset,
+ virtual void EmitWinCFIPushReg(MCRegister Register, SMLoc Loc = SMLoc());
+ virtual void EmitWinCFISetFrame(MCRegister Register, unsigned Offset,
SMLoc Loc = SMLoc());
virtual void EmitWinCFIAllocStack(unsigned Size, SMLoc Loc = SMLoc());
- virtual void EmitWinCFISaveReg(unsigned Register, unsigned Offset,
+ virtual void EmitWinCFISaveReg(MCRegister Register, unsigned Offset,
SMLoc Loc = SMLoc());
- virtual void EmitWinCFISaveXMM(unsigned Register, unsigned Offset,
+ virtual void EmitWinCFISaveXMM(MCRegister Register, unsigned Offset,
SMLoc Loc = SMLoc());
virtual void EmitWinCFIPushFrame(bool Code, SMLoc Loc = SMLoc());
virtual void EmitWinCFIEndProlog(SMLoc Loc = SMLoc());
#include "llvm/MC/MCInstPrinter.h"
#include "llvm/MC/MCObjectFileInfo.h"
#include "llvm/MC/MCObjectWriter.h"
+#include "llvm/MC/MCRegister.h"
#include "llvm/MC/MCRegisterInfo.h"
#include "llvm/MC/MCSectionMachO.h"
#include "llvm/MC/MCStreamer.h"
void EmitWinCFIFuncletOrFuncEnd(SMLoc Loc) override;
void EmitWinCFIStartChained(SMLoc Loc) override;
void EmitWinCFIEndChained(SMLoc Loc) override;
- void EmitWinCFIPushReg(unsigned Register, SMLoc Loc) override;
- void EmitWinCFISetFrame(unsigned Register, unsigned Offset,
+ void EmitWinCFIPushReg(MCRegister Register, SMLoc Loc) override;
+ void EmitWinCFISetFrame(MCRegister Register, unsigned Offset,
SMLoc Loc) override;
void EmitWinCFIAllocStack(unsigned Size, SMLoc Loc) override;
- void EmitWinCFISaveReg(unsigned Register, unsigned Offset,
+ void EmitWinCFISaveReg(MCRegister Register, unsigned Offset,
SMLoc Loc) override;
- void EmitWinCFISaveXMM(unsigned Register, unsigned Offset,
+ void EmitWinCFISaveXMM(MCRegister Register, unsigned Offset,
SMLoc Loc) override;
void EmitWinCFIPushFrame(bool Code, SMLoc Loc) override;
void EmitWinCFIEndProlog(SMLoc Loc) override;
EmitEOL();
}
-void MCAsmStreamer::EmitWinCFIPushReg(unsigned Register, SMLoc Loc) {
+void MCAsmStreamer::EmitWinCFIPushReg(MCRegister Register, SMLoc Loc) {
MCStreamer::EmitWinCFIPushReg(Register, Loc);
- OS << "\t.seh_pushreg " << Register;
+ OS << "\t.seh_pushreg ";
+ InstPrinter->printRegName(OS, Register);
EmitEOL();
}
-void MCAsmStreamer::EmitWinCFISetFrame(unsigned Register, unsigned Offset,
+void MCAsmStreamer::EmitWinCFISetFrame(MCRegister Register, unsigned Offset,
SMLoc Loc) {
MCStreamer::EmitWinCFISetFrame(Register, Offset, Loc);
- OS << "\t.seh_setframe " << Register << ", " << Offset;
+ OS << "\t.seh_setframe ";
+ InstPrinter->printRegName(OS, Register);
+ OS << ", " << Offset;
EmitEOL();
}
EmitEOL();
}
-void MCAsmStreamer::EmitWinCFISaveReg(unsigned Register, unsigned Offset,
+void MCAsmStreamer::EmitWinCFISaveReg(MCRegister Register, unsigned Offset,
SMLoc Loc) {
MCStreamer::EmitWinCFISaveReg(Register, Offset, Loc);
- OS << "\t.seh_savereg " << Register << ", " << Offset;
+ OS << "\t.seh_savereg ";
+ InstPrinter->printRegName(OS, Register);
+ OS << ", " << Offset;
EmitEOL();
}
-void MCAsmStreamer::EmitWinCFISaveXMM(unsigned Register, unsigned Offset,
+void MCAsmStreamer::EmitWinCFISaveXMM(MCRegister Register, unsigned Offset,
SMLoc Loc) {
MCStreamer::EmitWinCFISaveXMM(Register, Offset, Loc);
- OS << "\t.seh_savexmm " << Register << ", " << Offset;
+ OS << "\t.seh_savexmm ";
+ InstPrinter->printRegName(OS, Register);
+ OS << ", " << Offset;
EmitEOL();
}
".seh_handler");
addDirectiveHandler<&COFFAsmParser::ParseSEHDirectiveHandlerData>(
".seh_handlerdata");
- addDirectiveHandler<&COFFAsmParser::ParseSEHDirectivePushReg>(
- ".seh_pushreg");
- addDirectiveHandler<&COFFAsmParser::ParseSEHDirectiveSetFrame>(
- ".seh_setframe");
addDirectiveHandler<&COFFAsmParser::ParseSEHDirectiveAllocStack>(
".seh_stackalloc");
- addDirectiveHandler<&COFFAsmParser::ParseSEHDirectiveSaveReg>(
- ".seh_savereg");
- addDirectiveHandler<&COFFAsmParser::ParseSEHDirectiveSaveXMM>(
- ".seh_savexmm");
- addDirectiveHandler<&COFFAsmParser::ParseSEHDirectivePushFrame>(
- ".seh_pushframe");
addDirectiveHandler<&COFFAsmParser::ParseSEHDirectiveEndProlog>(
".seh_endprologue");
addDirectiveHandler<&COFFAsmParser::ParseDirectiveSymbolAttribute>(".weak");
bool ParseSEHDirectiveEndChained(StringRef, SMLoc);
bool ParseSEHDirectiveHandler(StringRef, SMLoc);
bool ParseSEHDirectiveHandlerData(StringRef, SMLoc);
- bool ParseSEHDirectivePushReg(StringRef, SMLoc);
- bool ParseSEHDirectiveSetFrame(StringRef, SMLoc);
bool ParseSEHDirectiveAllocStack(StringRef, SMLoc);
- bool ParseSEHDirectiveSaveReg(StringRef, SMLoc);
- bool ParseSEHDirectiveSaveXMM(StringRef, SMLoc);
- bool ParseSEHDirectivePushFrame(StringRef, SMLoc);
bool ParseSEHDirectiveEndProlog(StringRef, SMLoc);
bool ParseAtUnwindOrAtExcept(bool &unwind, bool &except);
return false;
}
-bool COFFAsmParser::ParseSEHDirectivePushReg(StringRef, SMLoc Loc) {
- unsigned Reg = 0;
- if (ParseSEHRegisterNumber(Reg))
- return true;
-
- if (getLexer().isNot(AsmToken::EndOfStatement))
- return TokError("unexpected token in directive");
-
- Lex();
- getStreamer().EmitWinCFIPushReg(Reg, Loc);
- return false;
-}
-
-bool COFFAsmParser::ParseSEHDirectiveSetFrame(StringRef, SMLoc Loc) {
- unsigned Reg = 0;
- int64_t Off;
- if (ParseSEHRegisterNumber(Reg))
- return true;
- if (getLexer().isNot(AsmToken::Comma))
- return TokError("you must specify a stack pointer offset");
-
- Lex();
- if (getParser().parseAbsoluteExpression(Off))
- return true;
-
- if (getLexer().isNot(AsmToken::EndOfStatement))
- return TokError("unexpected token in directive");
-
- Lex();
- getStreamer().EmitWinCFISetFrame(Reg, Off, Loc);
- return false;
-}
-
bool COFFAsmParser::ParseSEHDirectiveAllocStack(StringRef, SMLoc Loc) {
int64_t Size;
if (getParser().parseAbsoluteExpression(Size))
return false;
}
-bool COFFAsmParser::ParseSEHDirectiveSaveReg(StringRef, SMLoc Loc) {
- unsigned Reg = 0;
- int64_t Off;
- if (ParseSEHRegisterNumber(Reg))
- return true;
- if (getLexer().isNot(AsmToken::Comma))
- return TokError("you must specify an offset on the stack");
-
- Lex();
- if (getParser().parseAbsoluteExpression(Off))
- return true;
-
- if (getLexer().isNot(AsmToken::EndOfStatement))
- return TokError("unexpected token in directive");
-
- Lex();
- // FIXME: Err on %xmm* registers
- getStreamer().EmitWinCFISaveReg(Reg, Off, Loc);
- return false;
-}
-
-// FIXME: This method is inherently x86-specific. It should really be in the
-// x86 backend.
-bool COFFAsmParser::ParseSEHDirectiveSaveXMM(StringRef, SMLoc Loc) {
- unsigned Reg = 0;
- int64_t Off;
- if (ParseSEHRegisterNumber(Reg))
- return true;
- if (getLexer().isNot(AsmToken::Comma))
- return TokError("you must specify an offset on the stack");
-
- Lex();
- if (getParser().parseAbsoluteExpression(Off))
- return true;
-
- if (getLexer().isNot(AsmToken::EndOfStatement))
- return TokError("unexpected token in directive");
-
- Lex();
- // FIXME: Err on non-%xmm* registers
- getStreamer().EmitWinCFISaveXMM(Reg, Off, Loc);
- return false;
-}
-
-bool COFFAsmParser::ParseSEHDirectivePushFrame(StringRef, SMLoc Loc) {
- bool Code = false;
- StringRef CodeID;
- if (getLexer().is(AsmToken::At)) {
- SMLoc startLoc = getLexer().getLoc();
- Lex();
- if (!getParser().parseIdentifier(CodeID)) {
- if (CodeID != "code")
- return Error(startLoc, "expected @code");
- Code = true;
- }
- }
-
- if (getLexer().isNot(AsmToken::EndOfStatement))
- return TokError("unexpected token in directive");
-
- Lex();
- getStreamer().EmitWinCFIPushFrame(Code, Loc);
- return false;
-}
-
bool COFFAsmParser::ParseSEHDirectiveEndProlog(StringRef, SMLoc Loc) {
Lex();
getStreamer().EmitWinCFIEndProlog(Loc);
return false;
}
-bool COFFAsmParser::ParseSEHRegisterNumber(unsigned &RegNo) {
- SMLoc startLoc = getLexer().getLoc();
- if (getLexer().is(AsmToken::Percent)) {
- const MCRegisterInfo *MRI = getContext().getRegisterInfo();
- SMLoc endLoc;
- unsigned LLVMRegNo;
- if (getParser().getTargetParser().ParseRegister(LLVMRegNo,startLoc,endLoc))
- return true;
-
-#if 0
- // FIXME: TargetAsmInfo::getCalleeSavedRegs() commits a serious layering
- // violation so this validation code is disabled.
-
- // Check that this is a non-volatile register.
- const unsigned *NVRegs = TAI.getCalleeSavedRegs();
- unsigned i;
- for (i = 0; NVRegs[i] != 0; ++i)
- if (NVRegs[i] == LLVMRegNo)
- break;
- if (NVRegs[i] == 0)
- return Error(startLoc, "expected non-volatile register");
-#endif
-
- int SEHRegNo = MRI->getSEHRegNum(LLVMRegNo);
- if (SEHRegNo < 0)
- return Error(startLoc,"register can't be represented in SEH unwind info");
- RegNo = SEHRegNo;
- }
- else {
- int64_t n;
- if (getParser().parseAbsoluteExpression(n))
- return true;
- if (n > 15)
- return Error(startLoc, "register number is too high");
- RegNo = n;
- }
-
- return false;
-}
-
namespace llvm {
MCAsmParserExtension *createCOFFAsmParser() {
#include "llvm/MC/MCInst.h"
#include "llvm/MC/MCInstPrinter.h"
#include "llvm/MC/MCObjectFileInfo.h"
+#include "llvm/MC/MCRegister.h"
+#include "llvm/MC/MCRegisterInfo.h"
#include "llvm/MC/MCSection.h"
#include "llvm/MC/MCSectionCOFF.h"
#include "llvm/MC/MCSymbol.h"
void MCStreamer::EmitSyntaxDirective() {}
-void MCStreamer::EmitWinCFIPushReg(unsigned Register, SMLoc Loc) {
+static unsigned encodeSEHRegNum(MCContext &Ctx, MCRegister Reg) {
+ return Ctx.getRegisterInfo()->getSEHRegNum(Reg);
+}
+
+void MCStreamer::EmitWinCFIPushReg(MCRegister Register, SMLoc Loc) {
WinEH::FrameInfo *CurFrame = EnsureValidWinFrameInfo(Loc);
if (!CurFrame)
return;
MCSymbol *Label = EmitCFILabel();
- WinEH::Instruction Inst = Win64EH::Instruction::PushNonVol(Label, Register);
+ WinEH::Instruction Inst = Win64EH::Instruction::PushNonVol(
+ Label, encodeSEHRegNum(Context, Register));
CurFrame->Instructions.push_back(Inst);
}
-void MCStreamer::EmitWinCFISetFrame(unsigned Register, unsigned Offset,
+void MCStreamer::EmitWinCFISetFrame(MCRegister Register, unsigned Offset,
SMLoc Loc) {
WinEH::FrameInfo *CurFrame = EnsureValidWinFrameInfo(Loc);
if (!CurFrame)
MCSymbol *Label = EmitCFILabel();
- WinEH::Instruction Inst =
- Win64EH::Instruction::SetFPReg(Label, Register, Offset);
+ WinEH::Instruction Inst = Win64EH::Instruction::SetFPReg(
+ Label, encodeSEHRegNum(getContext(), Register), Offset);
CurFrame->LastFrameInst = CurFrame->Instructions.size();
CurFrame->Instructions.push_back(Inst);
}
CurFrame->Instructions.push_back(Inst);
}
-void MCStreamer::EmitWinCFISaveReg(unsigned Register, unsigned Offset,
+void MCStreamer::EmitWinCFISaveReg(MCRegister Register, unsigned Offset,
SMLoc Loc) {
WinEH::FrameInfo *CurFrame = EnsureValidWinFrameInfo(Loc);
if (!CurFrame)
MCSymbol *Label = EmitCFILabel();
- WinEH::Instruction Inst =
- Win64EH::Instruction::SaveNonVol(Label, Register, Offset);
+ WinEH::Instruction Inst = Win64EH::Instruction::SaveNonVol(
+ Label, encodeSEHRegNum(Context, Register), Offset);
CurFrame->Instructions.push_back(Inst);
}
-void MCStreamer::EmitWinCFISaveXMM(unsigned Register, unsigned Offset,
+void MCStreamer::EmitWinCFISaveXMM(MCRegister Register, unsigned Offset,
SMLoc Loc) {
WinEH::FrameInfo *CurFrame = EnsureValidWinFrameInfo(Loc);
if (!CurFrame)
MCSymbol *Label = EmitCFILabel();
- WinEH::Instruction Inst =
- Win64EH::Instruction::SaveXMM(Label, Register, Offset);
+ WinEH::Instruction Inst = Win64EH::Instruction::SaveXMM(
+ Label, encodeSEHRegNum(Context, Register), Offset);
CurFrame->Instructions.push_back(Inst);
}
bool parseDirectiveFPOEndProc(SMLoc L);
bool parseDirectiveFPOData(SMLoc L);
+ /// SEH directives.
+ bool parseSEHRegisterNumber(unsigned RegClassID, unsigned &RegNo);
+ bool parseDirectiveSEHPushReg(SMLoc);
+ bool parseDirectiveSEHSetFrame(SMLoc);
+ bool parseDirectiveSEHAllocStack(SMLoc);
+ bool parseDirectiveSEHSaveReg(SMLoc);
+ bool parseDirectiveSEHSaveXMM(SMLoc);
+ bool parseDirectiveSEHPushFrame(SMLoc);
+
unsigned checkTargetMatchPredicate(MCInst &Inst) override;
bool validateInstruction(MCInst &Inst, const OperandVector &Ops);
return parseDirectiveFPOEndPrologue(DirectiveID.getLoc());
else if (IDVal == ".cv_fpo_endproc")
return parseDirectiveFPOEndProc(DirectiveID.getLoc());
+ else if (IDVal == ".seh_pushreg")
+ return parseDirectiveSEHPushReg(DirectiveID.getLoc());
+ else if (IDVal == ".seh_setframe")
+ return parseDirectiveSEHSetFrame(DirectiveID.getLoc());
+ else if (IDVal == ".seh_savereg")
+ return parseDirectiveSEHSaveReg(DirectiveID.getLoc());
+ else if (IDVal == ".seh_savexmm")
+ return parseDirectiveSEHSaveXMM(DirectiveID.getLoc());
+ else if (IDVal == ".seh_pushframe")
+ return parseDirectiveSEHPushFrame(DirectiveID.getLoc());
return true;
}
return getTargetStreamer().emitFPOEndProc(L);
}
+bool X86AsmParser::parseSEHRegisterNumber(unsigned RegClassID,
+ unsigned &RegNo) {
+ SMLoc startLoc = getLexer().getLoc();
+ const MCRegisterInfo *MRI = getContext().getRegisterInfo();
+
+ // A percent indicates a symbolic register name. Parse it as usual and check
+ // the register class.
+ if (getLexer().is(AsmToken::Percent)) {
+ SMLoc endLoc;
+ if (getParser().getTargetParser().ParseRegister(RegNo, startLoc, endLoc))
+ return true;
+
+ if (!X86MCRegisterClasses[RegClassID].contains(RegNo)) {
+ return Error(startLoc,
+ "register is not supported for use with this directive");
+ }
+ } else {
+ // Otherwise, an integer number matching the encoding of the desired
+ // register may appear.
+ int64_t EncodedReg;
+ if (getParser().parseAbsoluteExpression(EncodedReg))
+ return true;
+
+ // The SEH register number is the same as the encoding register number. Map
+ // from the encoding back to the LLVM register number.
+ RegNo = 0;
+ for (MCPhysReg Reg : X86MCRegisterClasses[RegClassID]) {
+ if (MRI->getEncodingValue(Reg) == EncodedReg) {
+ RegNo = Reg;
+ break;
+ }
+ }
+ if (RegNo == 0) {
+ return Error(startLoc,
+ "incorrect register number for use with this directive");
+ }
+ }
+
+ return false;
+}
+
+bool X86AsmParser::parseDirectiveSEHPushReg(SMLoc Loc) {
+ unsigned Reg = 0;
+ if (parseSEHRegisterNumber(X86::GR64RegClassID, Reg))
+ return true;
+
+ if (getLexer().isNot(AsmToken::EndOfStatement))
+ return TokError("unexpected token in directive");
+
+ getParser().Lex();
+ getStreamer().EmitWinCFIPushReg(Reg, Loc);
+ return false;
+}
+
+bool X86AsmParser::parseDirectiveSEHSetFrame(SMLoc Loc) {
+ unsigned Reg = 0;
+ int64_t Off;
+ if (parseSEHRegisterNumber(X86::GR64RegClassID, Reg))
+ return true;
+ if (getLexer().isNot(AsmToken::Comma))
+ return TokError("you must specify a stack pointer offset");
+
+ getParser().Lex();
+ if (getParser().parseAbsoluteExpression(Off))
+ return true;
+
+ if (getLexer().isNot(AsmToken::EndOfStatement))
+ return TokError("unexpected token in directive");
+
+ getParser().Lex();
+ getStreamer().EmitWinCFISetFrame(Reg, Off, Loc);
+ return false;
+}
+
+bool X86AsmParser::parseDirectiveSEHAllocStack(SMLoc Loc) {
+ int64_t Size;
+ if (getParser().parseAbsoluteExpression(Size))
+ return true;
+
+ if (getLexer().isNot(AsmToken::EndOfStatement))
+ return TokError("unexpected token in directive");
+
+ getParser().Lex();
+ getStreamer().EmitWinCFIAllocStack(Size, Loc);
+ return false;
+}
+
+bool X86AsmParser::parseDirectiveSEHSaveReg(SMLoc Loc) {
+ unsigned Reg = 0;
+ int64_t Off;
+ if (parseSEHRegisterNumber(X86::GR64RegClassID, Reg))
+ return true;
+ if (getLexer().isNot(AsmToken::Comma))
+ return TokError("you must specify an offset on the stack");
+
+ getParser().Lex();
+ if (getParser().parseAbsoluteExpression(Off))
+ return true;
+
+ if (getLexer().isNot(AsmToken::EndOfStatement))
+ return TokError("unexpected token in directive");
+
+ getParser().Lex();
+ getStreamer().EmitWinCFISaveReg(Reg, Off, Loc);
+ return false;
+}
+
+bool X86AsmParser::parseDirectiveSEHSaveXMM(SMLoc Loc) {
+ unsigned Reg = 0;
+ int64_t Off;
+ if (parseSEHRegisterNumber(X86::VR128XRegClassID, Reg))
+ return true;
+ if (getLexer().isNot(AsmToken::Comma))
+ return TokError("you must specify an offset on the stack");
+
+ getParser().Lex();
+ if (getParser().parseAbsoluteExpression(Off))
+ return true;
+
+ if (getLexer().isNot(AsmToken::EndOfStatement))
+ return TokError("unexpected token in directive");
+
+ getParser().Lex();
+ getStreamer().EmitWinCFISaveXMM(Reg, Off, Loc);
+ return false;
+}
+
+bool X86AsmParser::parseDirectiveSEHPushFrame(SMLoc Loc) {
+ bool Code = false;
+ StringRef CodeID;
+ if (getLexer().is(AsmToken::At)) {
+ SMLoc startLoc = getLexer().getLoc();
+ getParser().Lex();
+ if (!getParser().parseIdentifier(CodeID)) {
+ if (CodeID != "code")
+ return Error(startLoc, "expected @code");
+ Code = true;
+ }
+ }
+
+ if (getLexer().isNot(AsmToken::EndOfStatement))
+ return TokError("unexpected token in directive");
+
+ getParser().Lex();
+ getStreamer().EmitWinCFIPushFrame(Code, Loc);
+ return false;
+}
+
// Force static initialization.
extern "C" void LLVMInitializeX86AsmParser() {
RegisterMCAsmParser<X86AsmParser> X(getTheX86_32Target());
void X86AsmPrinter::EmitSEHInstruction(const MachineInstr *MI) {
assert(MF->hasWinCFI() && "SEH_ instruction in function without WinCFI?");
assert(getSubtarget().isOSWindows() && "SEH_ instruction Windows only");
- const X86RegisterInfo *RI =
- MF->getSubtarget<X86Subtarget>().getRegisterInfo();
// Use the .cv_fpo directives if we're emitting CodeView on 32-bit x86.
if (EmitFPOData) {
// Otherwise, use the .seh_ directives for all other Windows platforms.
switch (MI->getOpcode()) {
case X86::SEH_PushReg:
- OutStreamer->EmitWinCFIPushReg(
- RI->getSEHRegNum(MI->getOperand(0).getImm()));
+ OutStreamer->EmitWinCFIPushReg(MI->getOperand(0).getImm());
break;
case X86::SEH_SaveReg:
- OutStreamer->EmitWinCFISaveReg(RI->getSEHRegNum(MI->getOperand(0).getImm()),
+ OutStreamer->EmitWinCFISaveReg(MI->getOperand(0).getImm(),
MI->getOperand(1).getImm());
break;
case X86::SEH_SaveXMM:
- OutStreamer->EmitWinCFISaveXMM(RI->getSEHRegNum(MI->getOperand(0).getImm()),
+ OutStreamer->EmitWinCFISaveXMM(MI->getOperand(0).getImm(),
MI->getOperand(1).getImm());
break;
break;
case X86::SEH_SetFrame:
- OutStreamer->EmitWinCFISetFrame(
- RI->getSEHRegNum(MI->getOperand(0).getImm()),
- MI->getOperand(1).getImm());
+ OutStreamer->EmitWinCFISetFrame(MI->getOperand(0).getImm(),
+ MI->getOperand(1).getImm());
break;
case X86::SEH_PushFrame:
case X86::MASKPAIR16LOAD: {
int64_t Disp = MI->getOperand(1 + X86::AddrDisp).getImm();
assert(Disp >= 0 && Disp <= INT32_MAX - 2 && "Unexpected displacement");
- const X86RegisterInfo *RI =
- MF->getSubtarget<X86Subtarget>().getRegisterInfo();
Register Reg = MI->getOperand(0).getReg();
Register Reg0 = RI->getSubReg(Reg, X86::sub_mask_0);
Register Reg1 = RI->getSubReg(Reg, X86::sub_mask_1);
case X86::MASKPAIR16STORE: {
int64_t Disp = MI->getOperand(X86::AddrDisp).getImm();
assert(Disp >= 0 && Disp <= INT32_MAX - 2 && "Unexpected displacement");
- const X86RegisterInfo *RI =
- MF->getSubtarget<X86Subtarget>().getRegisterInfo();
Register Reg = MI->getOperand(X86::AddrNumOperands).getReg();
Register Reg0 = RI->getSubReg(Reg, X86::sub_mask_0);
Register Reg1 = RI->getSubReg(Reg, X86::sub_mask_1);
; WIN64-LABEL: caller_argv64i1:
; WIN64: # %bb.0: # %entry
; WIN64-NEXT: pushq %r15
-; WIN64-NEXT: .seh_pushreg 15
+; WIN64-NEXT: .seh_pushreg %r15
; WIN64-NEXT: pushq %r14
-; WIN64-NEXT: .seh_pushreg 14
+; WIN64-NEXT: .seh_pushreg %r14
; WIN64-NEXT: pushq %r12
-; WIN64-NEXT: .seh_pushreg 12
+; WIN64-NEXT: .seh_pushreg %r12
; WIN64-NEXT: pushq %rsi
-; WIN64-NEXT: .seh_pushreg 6
+; WIN64-NEXT: .seh_pushreg %rsi
; WIN64-NEXT: pushq %rdi
-; WIN64-NEXT: .seh_pushreg 7
+; WIN64-NEXT: .seh_pushreg %rdi
; WIN64-NEXT: subq $48, %rsp
; WIN64-NEXT: .seh_stackalloc 48
; WIN64-NEXT: vmovaps %xmm7, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill
-; WIN64-NEXT: .seh_savexmm 7, 32
+; WIN64-NEXT: .seh_savexmm %xmm7, 32
; WIN64-NEXT: vmovaps %xmm6, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill
-; WIN64-NEXT: .seh_savexmm 6, 16
+; WIN64-NEXT: .seh_savexmm %xmm6, 16
; WIN64-NEXT: .seh_endprologue
; WIN64-NEXT: movabsq $4294967298, %rax # imm = 0x100000002
; WIN64-NEXT: movq %rax, (%rsp)
; WIN64-LABEL: caller_retv64i1:
; WIN64: # %bb.0: # %entry
; WIN64-NEXT: pushq %rsi
-; WIN64-NEXT: .seh_pushreg 6
+; WIN64-NEXT: .seh_pushreg %rsi
; WIN64-NEXT: pushq %rdi
-; WIN64-NEXT: .seh_pushreg 7
+; WIN64-NEXT: .seh_pushreg %rdi
; WIN64-NEXT: subq $40, %rsp
; WIN64-NEXT: .seh_stackalloc 40
; WIN64-NEXT: vmovaps %xmm7, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill
-; WIN64-NEXT: .seh_savexmm 7, 16
+; WIN64-NEXT: .seh_savexmm %xmm7, 16
; WIN64-NEXT: vmovaps %xmm6, (%rsp) # 16-byte Spill
-; WIN64-NEXT: .seh_savexmm 6, 0
+; WIN64-NEXT: .seh_savexmm %xmm6, 0
; WIN64-NEXT: .seh_endprologue
; WIN64-NEXT: callq test_retv64i1
; WIN64-NEXT: kmovq %rax, %k0
; WIN64-LABEL: test_argv32i1:
; WIN64: # %bb.0: # %entry
; WIN64-NEXT: pushq %r11
-; WIN64-NEXT: .seh_pushreg 11
+; WIN64-NEXT: .seh_pushreg %r11
; WIN64-NEXT: pushq %r10
-; WIN64-NEXT: .seh_pushreg 10
+; WIN64-NEXT: .seh_pushreg %r10
; WIN64-NEXT: pushq %rsp
-; WIN64-NEXT: .seh_pushreg 4
+; WIN64-NEXT: .seh_pushreg %rsp
; WIN64-NEXT: subq $32, %rsp
; WIN64-NEXT: .seh_stackalloc 32
; WIN64-NEXT: .seh_endprologue
; WIN64-LABEL: caller_argv32i1:
; WIN64: # %bb.0: # %entry
; WIN64-NEXT: pushq %rsi
-; WIN64-NEXT: .seh_pushreg 6
+; WIN64-NEXT: .seh_pushreg %rsi
; WIN64-NEXT: pushq %rdi
-; WIN64-NEXT: .seh_pushreg 7
+; WIN64-NEXT: .seh_pushreg %rdi
; WIN64-NEXT: subq $40, %rsp
; WIN64-NEXT: .seh_stackalloc 40
; WIN64-NEXT: vmovaps %xmm7, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill
-; WIN64-NEXT: .seh_savexmm 7, 16
+; WIN64-NEXT: .seh_savexmm %xmm7, 16
; WIN64-NEXT: vmovaps %xmm6, (%rsp) # 16-byte Spill
-; WIN64-NEXT: .seh_savexmm 6, 0
+; WIN64-NEXT: .seh_savexmm %xmm6, 0
; WIN64-NEXT: .seh_endprologue
; WIN64-NEXT: movl $1, %eax
; WIN64-NEXT: movl $1, %ecx
; WIN64-LABEL: caller_retv32i1:
; WIN64: # %bb.0: # %entry
; WIN64-NEXT: pushq %rsi
-; WIN64-NEXT: .seh_pushreg 6
+; WIN64-NEXT: .seh_pushreg %rsi
; WIN64-NEXT: pushq %rdi
-; WIN64-NEXT: .seh_pushreg 7
+; WIN64-NEXT: .seh_pushreg %rdi
; WIN64-NEXT: subq $40, %rsp
; WIN64-NEXT: .seh_stackalloc 40
; WIN64-NEXT: vmovaps %xmm7, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill
-; WIN64-NEXT: .seh_savexmm 7, 16
+; WIN64-NEXT: .seh_savexmm %xmm7, 16
; WIN64-NEXT: vmovaps %xmm6, (%rsp) # 16-byte Spill
-; WIN64-NEXT: .seh_savexmm 6, 0
+; WIN64-NEXT: .seh_savexmm %xmm6, 0
; WIN64-NEXT: .seh_endprologue
; WIN64-NEXT: callq test_retv32i1
; WIN64-NEXT: incl %eax
; WIN64-LABEL: test_argv16i1:
; WIN64: # %bb.0:
; WIN64-NEXT: pushq %r11
-; WIN64-NEXT: .seh_pushreg 11
+; WIN64-NEXT: .seh_pushreg %r11
; WIN64-NEXT: pushq %r10
-; WIN64-NEXT: .seh_pushreg 10
+; WIN64-NEXT: .seh_pushreg %r10
; WIN64-NEXT: pushq %rsp
-; WIN64-NEXT: .seh_pushreg 4
+; WIN64-NEXT: .seh_pushreg %rsp
; WIN64-NEXT: subq $32, %rsp
; WIN64-NEXT: .seh_stackalloc 32
; WIN64-NEXT: .seh_endprologue
; WIN64-LABEL: caller_argv16i1:
; WIN64: # %bb.0: # %entry
; WIN64-NEXT: pushq %rsi
-; WIN64-NEXT: .seh_pushreg 6
+; WIN64-NEXT: .seh_pushreg %rsi
; WIN64-NEXT: pushq %rdi
-; WIN64-NEXT: .seh_pushreg 7
+; WIN64-NEXT: .seh_pushreg %rdi
; WIN64-NEXT: subq $40, %rsp
; WIN64-NEXT: .seh_stackalloc 40
; WIN64-NEXT: vmovaps %xmm7, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill
-; WIN64-NEXT: .seh_savexmm 7, 16
+; WIN64-NEXT: .seh_savexmm %xmm7, 16
; WIN64-NEXT: vmovaps %xmm6, (%rsp) # 16-byte Spill
-; WIN64-NEXT: .seh_savexmm 6, 0
+; WIN64-NEXT: .seh_savexmm %xmm6, 0
; WIN64-NEXT: .seh_endprologue
; WIN64-NEXT: movl $1, %eax
; WIN64-NEXT: movl $1, %ecx
; WIN64-LABEL: caller_retv16i1:
; WIN64: # %bb.0: # %entry
; WIN64-NEXT: pushq %rsi
-; WIN64-NEXT: .seh_pushreg 6
+; WIN64-NEXT: .seh_pushreg %rsi
; WIN64-NEXT: pushq %rdi
-; WIN64-NEXT: .seh_pushreg 7
+; WIN64-NEXT: .seh_pushreg %rdi
; WIN64-NEXT: subq $40, %rsp
; WIN64-NEXT: .seh_stackalloc 40
; WIN64-NEXT: vmovaps %xmm7, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill
-; WIN64-NEXT: .seh_savexmm 7, 16
+; WIN64-NEXT: .seh_savexmm %xmm7, 16
; WIN64-NEXT: vmovaps %xmm6, (%rsp) # 16-byte Spill
-; WIN64-NEXT: .seh_savexmm 6, 0
+; WIN64-NEXT: .seh_savexmm %xmm6, 0
; WIN64-NEXT: .seh_endprologue
; WIN64-NEXT: callq test_retv16i1
; WIN64-NEXT: # kill: def $ax killed $ax def $eax
; WIN64-LABEL: test_argv8i1:
; WIN64: # %bb.0:
; WIN64-NEXT: pushq %r11
-; WIN64-NEXT: .seh_pushreg 11
+; WIN64-NEXT: .seh_pushreg %r11
; WIN64-NEXT: pushq %r10
-; WIN64-NEXT: .seh_pushreg 10
+; WIN64-NEXT: .seh_pushreg %r10
; WIN64-NEXT: pushq %rsp
-; WIN64-NEXT: .seh_pushreg 4
+; WIN64-NEXT: .seh_pushreg %rsp
; WIN64-NEXT: subq $32, %rsp
; WIN64-NEXT: .seh_stackalloc 32
; WIN64-NEXT: .seh_endprologue
; WIN64-LABEL: caller_argv8i1:
; WIN64: # %bb.0: # %entry
; WIN64-NEXT: pushq %rsi
-; WIN64-NEXT: .seh_pushreg 6
+; WIN64-NEXT: .seh_pushreg %rsi
; WIN64-NEXT: pushq %rdi
-; WIN64-NEXT: .seh_pushreg 7
+; WIN64-NEXT: .seh_pushreg %rdi
; WIN64-NEXT: subq $40, %rsp
; WIN64-NEXT: .seh_stackalloc 40
; WIN64-NEXT: vmovaps %xmm7, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill
-; WIN64-NEXT: .seh_savexmm 7, 16
+; WIN64-NEXT: .seh_savexmm %xmm7, 16
; WIN64-NEXT: vmovaps %xmm6, (%rsp) # 16-byte Spill
-; WIN64-NEXT: .seh_savexmm 6, 0
+; WIN64-NEXT: .seh_savexmm %xmm6, 0
; WIN64-NEXT: .seh_endprologue
; WIN64-NEXT: movl $1, %eax
; WIN64-NEXT: movl $1, %ecx
; WIN64-LABEL: caller_retv8i1:
; WIN64: # %bb.0: # %entry
; WIN64-NEXT: pushq %rsi
-; WIN64-NEXT: .seh_pushreg 6
+; WIN64-NEXT: .seh_pushreg %rsi
; WIN64-NEXT: pushq %rdi
-; WIN64-NEXT: .seh_pushreg 7
+; WIN64-NEXT: .seh_pushreg %rdi
; WIN64-NEXT: subq $40, %rsp
; WIN64-NEXT: .seh_stackalloc 40
; WIN64-NEXT: vmovaps %xmm7, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill
-; WIN64-NEXT: .seh_savexmm 7, 16
+; WIN64-NEXT: .seh_savexmm %xmm7, 16
; WIN64-NEXT: vmovaps %xmm6, (%rsp) # 16-byte Spill
-; WIN64-NEXT: .seh_savexmm 6, 0
+; WIN64-NEXT: .seh_savexmm %xmm6, 0
; WIN64-NEXT: .seh_endprologue
; WIN64-NEXT: callq test_retv8i1
; WIN64-NEXT: # kill: def $al killed $al def $eax
; WIN64-LABEL: test_CallargReti1:
; WIN64: # %bb.0:
; WIN64-NEXT: pushq %rsp
-; WIN64-NEXT: .seh_pushreg 4
+; WIN64-NEXT: .seh_pushreg %rsp
; WIN64-NEXT: .seh_endprologue
; WIN64-NEXT: incb %al
; WIN64-NEXT: movzbl %al, %eax
; WIN64-LABEL: test_CallargReti8:
; WIN64: # %bb.0:
; WIN64-NEXT: pushq %rsp
-; WIN64-NEXT: .seh_pushreg 4
+; WIN64-NEXT: .seh_pushreg %rsp
; WIN64-NEXT: .seh_endprologue
; WIN64-NEXT: incb %al
; WIN64-NEXT: movzbl %al, %eax
; WIN64-LABEL: test_CallargReti16:
; WIN64: # %bb.0:
; WIN64-NEXT: pushq %rsp
-; WIN64-NEXT: .seh_pushreg 4
+; WIN64-NEXT: .seh_pushreg %rsp
; WIN64-NEXT: .seh_endprologue
; WIN64-NEXT: incl %eax
; WIN64-NEXT: callq test_argReti16
; WIN64-LABEL: test_CallargReti32:
; WIN64: # %bb.0:
; WIN64-NEXT: pushq %rsp
-; WIN64-NEXT: .seh_pushreg 4
+; WIN64-NEXT: .seh_pushreg %rsp
; WIN64-NEXT: .seh_endprologue
; WIN64-NEXT: incl %eax
; WIN64-NEXT: callq test_argReti32
; WIN64-LABEL: test_CallargReti64:
; WIN64: # %bb.0:
; WIN64-NEXT: pushq %rsp
-; WIN64-NEXT: .seh_pushreg 4
+; WIN64-NEXT: .seh_pushreg %rsp
; WIN64-NEXT: .seh_endprologue
; WIN64-NEXT: incq %rax
; WIN64-NEXT: callq test_argReti64
; WIN64-LABEL: test_CallargRetFloat:
; WIN64: # %bb.0:
; WIN64-NEXT: pushq %rsp
-; WIN64-NEXT: .seh_pushreg 4
+; WIN64-NEXT: .seh_pushreg %rsp
; WIN64-NEXT: subq $16, %rsp
; WIN64-NEXT: .seh_stackalloc 16
; WIN64-NEXT: vmovaps %xmm8, (%rsp) # 16-byte Spill
-; WIN64-NEXT: .seh_savexmm 8, 0
+; WIN64-NEXT: .seh_savexmm %xmm8, 0
; WIN64-NEXT: .seh_endprologue
; WIN64-NEXT: vmovss {{.*#+}} xmm8 = mem[0],zero,zero,zero
; WIN64-NEXT: vaddss %xmm8, %xmm0, %xmm0
; WIN64-LABEL: test_CallargRetDouble:
; WIN64: # %bb.0:
; WIN64-NEXT: pushq %rsp
-; WIN64-NEXT: .seh_pushreg 4
+; WIN64-NEXT: .seh_pushreg %rsp
; WIN64-NEXT: subq $16, %rsp
; WIN64-NEXT: .seh_stackalloc 16
; WIN64-NEXT: vmovaps %xmm8, (%rsp) # 16-byte Spill
-; WIN64-NEXT: .seh_savexmm 8, 0
+; WIN64-NEXT: .seh_savexmm %xmm8, 0
; WIN64-NEXT: .seh_endprologue
; WIN64-NEXT: vmovsd {{.*#+}} xmm8 = mem[0],zero
; WIN64-NEXT: vaddsd %xmm8, %xmm0, %xmm0
; WIN64-LABEL: test_CallargRetf80:
; WIN64: # %bb.0:
; WIN64-NEXT: pushq %rsp
-; WIN64-NEXT: .seh_pushreg 4
+; WIN64-NEXT: .seh_pushreg %rsp
; WIN64-NEXT: .seh_endprologue
; WIN64-NEXT: fadd %st, %st(0)
; WIN64-NEXT: callq test_argRetf80
; WIN64-LABEL: test_CallargRetPointer:
; WIN64: # %bb.0:
; WIN64-NEXT: pushq %rsp
-; WIN64-NEXT: .seh_pushreg 4
+; WIN64-NEXT: .seh_pushreg %rsp
; WIN64-NEXT: .seh_endprologue
; WIN64-NEXT: incl %eax
; WIN64-NEXT: callq test_argRetPointer
; WIN64-LABEL: test_CallargRet128Vector:
; WIN64: # %bb.0:
; WIN64-NEXT: pushq %rsp
-; WIN64-NEXT: .seh_pushreg 4
+; WIN64-NEXT: .seh_pushreg %rsp
; WIN64-NEXT: subq $32, %rsp
; WIN64-NEXT: .seh_stackalloc 32
; WIN64-NEXT: vmovaps %xmm8, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill
-; WIN64-NEXT: .seh_savexmm 8, 16
+; WIN64-NEXT: .seh_savexmm %xmm8, 16
; WIN64-NEXT: .seh_endprologue
; WIN64-NEXT: vmovdqa %xmm1, %xmm8
; WIN64-NEXT: vpslld $31, %xmm0, %xmm1
; WIN64-LABEL: test_CallargRet256Vector:
; WIN64: # %bb.0:
; WIN64-NEXT: pushq %rsp
-; WIN64-NEXT: .seh_pushreg 4
+; WIN64-NEXT: .seh_pushreg %rsp
; WIN64-NEXT: subq $80, %rsp
; WIN64-NEXT: .seh_stackalloc 80
; WIN64-NEXT: .seh_endprologue
; WIN64-LABEL: test_CallargRet512Vector:
; WIN64: # %bb.0:
; WIN64-NEXT: pushq %rsp
-; WIN64-NEXT: .seh_pushreg 4
+; WIN64-NEXT: .seh_pushreg %rsp
; WIN64-NEXT: subq $176, %rsp
; WIN64-NEXT: .seh_stackalloc 176
; WIN64-NEXT: .seh_endprologue
; CHECK: f: # @f
; CHECK: pushq %rbp
-; CHECK: .seh_pushreg 5
+; CHECK: .seh_pushreg %rbp
; CHECK: subq $64, %rsp
; CHECK: .seh_stackalloc 64
; CHECK: leaq 64(%rsp), %rbp
-; CHECK: .seh_setframe 5, 64
+; CHECK: .seh_setframe %rbp, 64
; CHECK: movaps %xmm6, -16(%rbp) # 16-byte Spill
-; CHECK: .seh_savexmm 6, 48
+; CHECK: .seh_savexmm %xmm6, 48
; CHECK: .seh_endprologue
; CHECK: movq $-2, -24(%rbp)
; CHECK: movsd fp_global(%rip), %xmm6 # xmm6 = mem[0],zero
; CHECK: # %catch
; CHECK: movq %rdx, 16(%rsp)
; CHECK: pushq %rbp
-; CHECK: .seh_pushreg 5
+; CHECK: .seh_pushreg %rbp
; CHECK: subq $48, %rsp
; CHECK: .seh_stackalloc 48
; CHECK: leaq 64(%rdx), %rbp
; CHECK: movapd %xmm6, 32(%rsp)
-; CHECK: .seh_savexmm 6, 32
+; CHECK: .seh_savexmm %xmm6, 32
; CHECK: .seh_endprologue
; CHECK: movapd 32(%rsp), %xmm6
; CHECK: leaq .LBB0_1(%rip), %rax
; X64-LABEL: realigned_cleanup: # @realigned_cleanup
; X64: pushq %rbp
-; X64: .seh_pushreg 5
+; X64: .seh_pushreg %rbp
; X64: pushq %rbx
-; X64: .seh_pushreg 3
+; X64: .seh_pushreg %rbx
; X64: subq $104, %rsp
; X64: .seh_stackalloc 104
; X64: leaq 96(%rsp), %rbp
-; X64: .seh_setframe 5, 96
+; X64: .seh_setframe %rbp, 96
; X64: .seh_endprologue
; X64: andq $-32, %rsp
; X64: movq %rsp, %rbx
; X64-LABEL: "?dtor$2@?0?realigned_cleanup@4HA":
; X64: movq %rdx, 16(%rsp)
; X64: pushq %rbp
-; X64: .seh_pushreg 5
+; X64: .seh_pushreg %rbp
; X64: pushq %rbx
-; X64: .seh_pushreg 3
+; X64: .seh_pushreg %rbx
; X64: subq $40, %rsp
; X64: .seh_stackalloc 40
; X64: leaq 96(%rdx), %rbp
; WIN64-LABEL: f_non_leaf:
; WIN64: # %bb.0: # %entry
; WIN64-NEXT: pushq %rbx # encoding: [0x53]
-; WIN64-NEXT: .seh_pushreg 3
+; WIN64-NEXT: .seh_pushreg %rbx
; WIN64-NEXT: .seh_endprologue
; WIN64-NEXT: #APP
; WIN64-NEXT: #NO_APP
; MINGW64: .seh_proc
; MINGW64: .seh_handler __gxx_personality_v0
-; MINGW64: .seh_setframe 5, 32
+; MINGW64: .seh_setframe %rbp, 32
; MINGW64: callq _Unwind_Resume
; MINGW64: .seh_handlerdata
; MINGW64: .seh_endproc
; X64: subq $16, %rsp
; X64: .seh_stackalloc 16
; X64: leaq 16(%rsp), %rbp
-; X64: .seh_setframe 5, 16
+; X64: .seh_setframe %rbp, 16
; X64: .set .Lalloc_func$frame_escape_0, -4
; X64: .set .Lalloc_func$frame_escape_1, -12
; X64: movl $42, -4(%rbp)
; WINDOWS-LABEL: f_thunk:
; WINDOWS: # %bb.0:
; WINDOWS-NEXT: pushq %r14
-; WINDOWS-NEXT: .seh_pushreg 14
+; WINDOWS-NEXT: .seh_pushreg %r14
; WINDOWS-NEXT: pushq %rsi
-; WINDOWS-NEXT: .seh_pushreg 6
+; WINDOWS-NEXT: .seh_pushreg %rsi
; WINDOWS-NEXT: pushq %rdi
-; WINDOWS-NEXT: .seh_pushreg 7
+; WINDOWS-NEXT: .seh_pushreg %rdi
; WINDOWS-NEXT: pushq %rbp
-; WINDOWS-NEXT: .seh_pushreg 5
+; WINDOWS-NEXT: .seh_pushreg %rbp
; WINDOWS-NEXT: pushq %rbx
-; WINDOWS-NEXT: .seh_pushreg 3
+; WINDOWS-NEXT: .seh_pushreg %rbx
; WINDOWS-NEXT: subq $64, %rsp
; WINDOWS-NEXT: .seh_stackalloc 64
; WINDOWS-NEXT: .seh_endprologue
; CHECK: .seh_proc main
; CHECK: .seh_handler __C_specific_handler, @unwind, @except
; CHECK: pushq %rbp
-; CHECK: .seh_pushreg 5
+; CHECK: .seh_pushreg %rbp
; CHECK: subq $32, %rsp
; CHECK: .seh_stackalloc 32
; CHECK: leaq 32(%rsp), %rbp
-; CHECK: .seh_setframe 5, 32
+; CHECK: .seh_setframe %rbp, 32
; CHECK: .seh_endprologue
; CHECK: .Ltmp0:
; CHECK: movl $1, %ecx
; CHECK: .LBB1_[[finbb]]: # %ehcleanup
; CHECK: movq %rdx, 16(%rsp)
; CHECK: pushq %rbp
-; CHECK: .seh_pushreg 5
+; CHECK: .seh_pushreg %rbp
; CHECK: subq $32, %rsp
; CHECK: .seh_stackalloc 32
; CHECK: leaq 32(%rdx), %rbp
; X64-LABEL: try_catch_catch:
; X64: pushq %rbp
-; X64: .seh_pushreg 5
+; X64: .seh_pushreg %rbp
; X64: pushq %rsi
-; X64: .seh_pushreg 6
+; X64: .seh_pushreg %rsi
; X64: pushq %rdi
-; X64: .seh_pushreg 7
+; X64: .seh_pushreg %rdi
; X64: pushq %rbx
-; X64: .seh_pushreg 3
+; X64: .seh_pushreg %rbx
; X64: subq $40, %rsp
; X64: .seh_stackalloc 40
; X64: leaq 32(%rsp), %rbp
-; X64: .seh_setframe 5, 32
+; X64: .seh_setframe %rbp, 32
; X64: .seh_endprologue
; X64: movq $-2, (%rbp)
; X64: callq getint
; X64: LBB0_[[catch1bb]]: # %handler1{{$}}
; X64: movq %rdx, 16(%rsp)
; X64: pushq %rbp
-; X64: .seh_pushreg 5
+; X64: .seh_pushreg %rbp
; X64: pushq %rsi
-; X64: .seh_pushreg 6
+; X64: .seh_pushreg %rsi
; X64: pushq %rdi
-; X64: .seh_pushreg 7
+; X64: .seh_pushreg %rdi
; X64: pushq %rbx
-; X64: .seh_pushreg 3
+; X64: .seh_pushreg %rbx
; X64: subq $40, %rsp
; X64: .seh_stackalloc 40
; X64: leaq 32(%rdx), %rbp
; X64-LABEL: try_one_csr:
; X64: pushq %rbp
-; X64: .seh_pushreg 5
+; X64: .seh_pushreg %rbp
; X64: pushq %rsi
-; X64: .seh_pushreg 6
+; X64: .seh_pushreg %rsi
; X64-NOT: pushq
; X64: subq $40, %rsp
; X64: .seh_stackalloc 40
; X64: leaq 32(%rsp), %rbp
-; X64: .seh_setframe 5, 32
+; X64: .seh_setframe %rbp, 32
; X64: .seh_endprologue
; X64: callq getint
; X64: callq getint
; X64: LBB1_[[catch1bb]]: # %handler1{{$}}
; X64: movq %rdx, 16(%rsp)
; X64: pushq %rbp
-; X64: .seh_pushreg 5
+; X64: .seh_pushreg %rbp
; X64: pushq %rsi
-; X64: .seh_pushreg 6
+; X64: .seh_pushreg %rsi
; X64: subq $40, %rsp
; X64: .seh_stackalloc 40
; X64: leaq 32(%rdx), %rbp
; X64-LABEL: try_no_csr:
; X64: pushq %rbp
-; X64: .seh_pushreg 5
+; X64: .seh_pushreg %rbp
; X64-NOT: pushq
; X64: subq $48, %rsp
; X64: .seh_stackalloc 48
; X64: leaq 48(%rsp), %rbp
-; X64: .seh_setframe 5, 48
+; X64: .seh_setframe %rbp, 48
; X64: .seh_endprologue
; X64: movl $1, %ecx
; X64: callq f
; X64: LBB2_[[catch1bb]]: # %handler1{{$}}
; X64: movq %rdx, 16(%rsp)
; X64: pushq %rbp
-; X64: .seh_pushreg 5
+; X64: .seh_pushreg %rbp
; X64: subq $32, %rsp
; X64: .seh_stackalloc 32
; X64: leaq 48(%rdx), %rbp
; X64-LABEL: try_catch_catch:
; X64: Lfunc_begin0:
; X64: pushq %rbp
-; X64: .seh_pushreg 5
+; X64: .seh_pushreg %rbp
; X64: subq $[[STCK_ALLOC:.*]], %rsp
; X64: .seh_stackalloc [[STCK_ALLOC]]
; X64: leaq [[STCK_ALLOC]](%rsp), %rbp
-; X64: .seh_setframe 5, [[STCK_ALLOC]]
+; X64: .seh_setframe %rbp, [[STCK_ALLOC]]
; X64: .seh_endprologue
; X64: movq $-2, -16(%rbp)
; X64: .Ltmp0
; X64: LBB0_[[catch1bb]]: # %handler1{{$}}
; X64: movq %rdx, 16(%rsp)
; X64: pushq %rbp
-; X64: .seh_pushreg 5
+; X64: .seh_pushreg %rbp
; X64: subq $32, %rsp
; X64: .seh_stackalloc 32
; X64: leaq [[STCK_ALLOC]](%rdx), %rbp
; X64: LBB0_[[catch2bb]]: # %handler2{{$}}
; X64: movq %rdx, 16(%rsp)
; X64: pushq %rbp
-; X64: .seh_pushreg 5
+; X64: .seh_pushreg %rbp
; X64: subq $32, %rsp
; X64: .seh_stackalloc 32
; X64: leaq [[STCK_ALLOC]](%rdx), %rbp
; X64-LABEL: branch_to_normal_dest:
; X64: # %entry
; X64: pushq %rbp
-; X64: .seh_pushreg 5
+; X64: .seh_pushreg %rbp
; X64: subq $48, %rsp
; X64: .seh_stackalloc 48
; X64: leaq 48(%rsp), %rbp
-; X64: .seh_setframe 5, 48
+; X64: .seh_setframe %rbp, 48
; X64: .seh_endprologue
; X64: .Ltmp[[before_call:[0-9]+]]:
; X64: callq f
; X64: LBB1_[[catchbb]]: # %catch{{$}}
; X64: movq %rdx, 16(%rsp)
; X64: pushq %rbp
-; X64: .seh_pushreg 5
+; X64: .seh_pushreg %rbp
; X64: subq $32, %rsp
; X64: .seh_stackalloc 32
; X64: leaq 48(%rdx), %rbp
; Emit CFI for pushing RBP.
; CHECK: movq %rdx, 16(%rsp)
; CHECK: pushq %rbp
-; CHECK: .seh_pushreg 5
+; CHECK: .seh_pushreg %rbp
; Emit CFI for allocating from the stack pointer.
; CHECK: subq $32, %rsp
; Emit CFI for pushing RBP.
; CHECK: movq %rdx, 16(%rsp)
; CHECK: pushq %rbp
-; CHECK: .seh_pushreg 5
+; CHECK: .seh_pushreg %rbp
; Emit CFI for allocating from the stack pointer.
; CHECK: subq $32, %rsp
; CHECK: # %catch
; CHECK: movq %rdx, 16(%rsp)
; CHECK: pushq %rbp
-; CHECK: .seh_pushreg 5
+; CHECK: .seh_pushreg %rbp
; CHECK: pushq %rbx
-; CHECK: .seh_pushreg 3
+; CHECK: .seh_pushreg %rbx
; CHECK: subq $88, %rsp
; CHECK: .seh_stackalloc 88
; CHECK: leaq 112(%rdx), %rbp
; CHECK: vmovaps %xmm8, 48(%rsp)
-; CHECK: .seh_savexmm 8, 48
+; CHECK: .seh_savexmm %xmm8, 48
; CHECK: vmovaps %xmm7, 64(%rsp)
-; CHECK: .seh_savexmm 7, 64
+; CHECK: .seh_savexmm %xmm7, 64
; CHECK: vmovaps %xmm6, 80(%rsp)
-; CHECK: .seh_savexmm 6, 80
+; CHECK: .seh_savexmm %xmm6, 80
; CHECK: .seh_endprologue
; CHECK: movl -{{[0-9]+}}(%rbp), %ecx
; CHECK: vmovaps 80(%rsp), %xmm6
; WIN64-LABEL: foo5:
; WIN64: .seh_proc foo5
; WIN64: pushq %rbp
-; WIN64: .seh_pushreg 5
+; WIN64: .seh_pushreg %rbp
; WIN64: pushq %rdi
-; WIN64: .seh_pushreg 7
+; WIN64: .seh_pushreg %rdi
; WIN64: pushq %rbx
-; WIN64: .seh_pushreg 3
+; WIN64: .seh_pushreg %rbx
; NORM: subq $96, %rsp
; ATOM: leaq -96(%rsp), %rsp
; WIN64: .seh_stackalloc 96
; WIN64: leaq 96(%rsp), %rbp
-; WIN64: .seh_setframe 5, 96
+; WIN64: .seh_setframe %rbp, 96
; WIN64: movaps %xmm7, -16(%rbp) # 16-byte Spill
-; WIN64: .seh_savexmm 7, 80
+; WIN64: .seh_savexmm %xmm7, 80
; WIN64: movaps %xmm6, -32(%rbp) # 16-byte Spill
-; WIN64: .seh_savexmm 6, 64
+; WIN64: .seh_savexmm %xmm6, 64
; WIN64: .seh_endprologue
; WIN64: andq $-64, %rsp
; WIN64: movaps -32(%rbp), %xmm6 # 16-byte Reload
; ALL-LABEL: f1:
; ALL: # %bb.0:
; ALL-NEXT: pushq %rbp
-; ALL-NEXT: .seh_pushreg 5
+; ALL-NEXT: .seh_pushreg %rbp
; ALL-NEXT: movq %rsp, %rbp
-; ALL-NEXT: .seh_setframe 5, 0
+; ALL-NEXT: .seh_setframe %rbp, 0
; ALL-NEXT: .seh_endprologue
; ALL-NEXT: movl 48(%rbp), %eax
; ALL-NEXT: popq %rbp
; ALL-LABEL: f2:
; ALL: # %bb.0:
; ALL-NEXT: pushq %rbp
-; ALL-NEXT: .seh_pushreg 5
+; ALL-NEXT: .seh_pushreg %rbp
; ALL-NEXT: pushq %rax
; ALL-NEXT: .seh_stackalloc 8
; ALL-NEXT: movq %rsp, %rbp
-; ALL-NEXT: .seh_setframe 5, 0
+; ALL-NEXT: .seh_setframe %rbp, 0
; ALL-NEXT: .seh_endprologue
; ALL-NEXT: movq %rdx, 32(%rbp)
; ALL-NEXT: movq %r8, 40(%rbp)
; ALL-LABEL: f3:
; ALL: # %bb.0:
; ALL-NEXT: pushq %rbp
-; ALL-NEXT: .seh_pushreg 5
+; ALL-NEXT: .seh_pushreg %rbp
; ALL-NEXT: movq %rsp, %rbp
-; ALL-NEXT: .seh_setframe 5, 0
+; ALL-NEXT: .seh_setframe %rbp, 0
; ALL-NEXT: .seh_endprologue
; ALL-NEXT: movq 8(%rbp), %rax
; ALL-NEXT: popq %rbp
; ALL-LABEL: f4:
; ALL: # %bb.0:
; ALL-NEXT: pushq %rbp
-; ALL-NEXT: .seh_pushreg 5
+; ALL-NEXT: .seh_pushreg %rbp
; ALL-NEXT: subq $304, %rsp # imm = 0x130
; ALL-NEXT: .seh_stackalloc 304
; ALL-NEXT: leaq {{[0-9]+}}(%rsp), %rbp
-; ALL-NEXT: .seh_setframe 5, 128
+; ALL-NEXT: .seh_setframe %rbp, 128
; ALL-NEXT: .seh_endprologue
; ALL-NEXT: movq 184(%rbp), %rax
; ALL-NEXT: addq $304, %rsp # imm = 0x130
; ALL-LABEL: f5:
; ALL: # %bb.0:
; ALL-NEXT: pushq %rbp
-; ALL-NEXT: .seh_pushreg 5
+; ALL-NEXT: .seh_pushreg %rbp
; ALL-NEXT: subq $336, %rsp # imm = 0x150
; ALL-NEXT: .seh_stackalloc 336
; ALL-NEXT: leaq {{[0-9]+}}(%rsp), %rbp
-; ALL-NEXT: .seh_setframe 5, 128
+; ALL-NEXT: .seh_setframe %rbp, 128
; ALL-NEXT: .seh_endprologue
; ALL-NEXT: leaq -92(%rbp), %rcx
; ALL-NEXT: callq external
; ALL-LABEL: f6:
; ALL: # %bb.0:
; ALL-NEXT: pushq %rbp
-; ALL-NEXT: .seh_pushreg 5
+; ALL-NEXT: .seh_pushreg %rbp
; ALL-NEXT: subq $336, %rsp # imm = 0x150
; ALL-NEXT: .seh_stackalloc 336
; ALL-NEXT: leaq {{[0-9]+}}(%rsp), %rbp
-; ALL-NEXT: .seh_setframe 5, 128
+; ALL-NEXT: .seh_setframe %rbp, 128
; ALL-NEXT: .seh_endprologue
; ALL-NEXT: leaq -92(%rbp), %rcx
; ALL-NEXT: callq external
; ALL-LABEL: f7:
; ALL: # %bb.0:
; ALL-NEXT: pushq %rbp
-; ALL-NEXT: .seh_pushreg 5
+; ALL-NEXT: .seh_pushreg %rbp
; ALL-NEXT: subq $304, %rsp # imm = 0x130
; ALL-NEXT: .seh_stackalloc 304
; ALL-NEXT: leaq {{[0-9]+}}(%rsp), %rbp
-; ALL-NEXT: .seh_setframe 5, 128
+; ALL-NEXT: .seh_setframe %rbp, 128
; ALL-NEXT: .seh_endprologue
; ALL-NEXT: andq $-64, %rsp
; ALL-NEXT: movl 224(%rbp), %eax
; ALL-LABEL: f8:
; ALL: # %bb.0:
; ALL-NEXT: pushq %rbp
-; ALL-NEXT: .seh_pushreg 5
+; ALL-NEXT: .seh_pushreg %rbp
; ALL-NEXT: pushq %rsi
-; ALL-NEXT: .seh_pushreg 6
+; ALL-NEXT: .seh_pushreg %rsi
; ALL-NEXT: pushq %rbx
-; ALL-NEXT: .seh_pushreg 3
+; ALL-NEXT: .seh_pushreg %rbx
; ALL-NEXT: subq $352, %rsp # imm = 0x160
; ALL-NEXT: .seh_stackalloc 352
; ALL-NEXT: leaq {{[0-9]+}}(%rsp), %rbp
-; ALL-NEXT: .seh_setframe 5, 128
+; ALL-NEXT: .seh_setframe %rbp, 128
; ALL-NEXT: .seh_endprologue
; ALL-NEXT: andq $-64, %rsp
; ALL-NEXT: movq %rsp, %rbx
; ALL-LABEL: f9:
; ALL: # %bb.0: # %entry
; ALL-NEXT: pushq %rbp
-; ALL-NEXT: .seh_pushreg 5
+; ALL-NEXT: .seh_pushreg %rbp
; ALL-NEXT: movq %rsp, %rbp
-; ALL-NEXT: .seh_setframe 5, 0
+; ALL-NEXT: .seh_setframe %rbp, 0
; ALL-NEXT: .seh_endprologue
; ALL-NEXT: pushfq
; ALL-NEXT: popq %rax
; ALL-LABEL: f10:
; ALL: # %bb.0:
; ALL-NEXT: pushq %rsi
-; ALL-NEXT: .seh_pushreg 6
+; ALL-NEXT: .seh_pushreg %rsi
; ALL-NEXT: pushq %rbx
-; ALL-NEXT: .seh_pushreg 3
+; ALL-NEXT: .seh_pushreg %rbx
; ALL-NEXT: subq $40, %rsp
; ALL-NEXT: .seh_stackalloc 40
; ALL-NEXT: .seh_endprologue
; ALL-LABEL: f11:
; ALL: # %bb.0:
; ALL-NEXT: pushq %rbp
-; ALL-NEXT: .seh_pushreg 5
+; ALL-NEXT: .seh_pushreg %rbp
; ALL-NEXT: movq %rsp, %rbp
-; ALL-NEXT: .seh_setframe 5, 0
+; ALL-NEXT: .seh_setframe %rbp, 0
; ALL-NEXT: .seh_endprologue
; ALL-NEXT: leaq 8(%rbp), %rax
; ALL-NEXT: popq %rbp
; CHECK-LABEL: read_flags:
; CHECK: pushq %rbp
-; CHECK: .seh_pushreg 5
+; CHECK: .seh_pushreg %rbp
; CHECK: movq %rsp, %rbp
-; CHECK: .seh_setframe 5, 0
+; CHECK: .seh_setframe %rbp, 0
; CHECK: .seh_endprologue
; CHECK-NEXT: pushfq
; CHECK-NEXT: popq %rax
; CHECK-LABEL: write_flags:
; CHECK: pushq %rbp
-; CHECK: .seh_pushreg 5
+; CHECK: .seh_pushreg %rbp
; CHECK: movq %rsp, %rbp
-; CHECK: .seh_setframe 5, 0
+; CHECK: .seh_setframe %rbp, 0
; CHECK: .seh_endprologue
; CHECK-NEXT: pushq %rcx
; CHECK-NEXT: popfq
# CHECK: .seh_stackalloc 24
movq %rsi, 16(%rsp)
.seh_savereg %rsi, 16
-# CHECK: .seh_savereg 6, 16
+# CHECK: .seh_savereg %rsi, 16
+ .seh_savereg 6, 16
+# CHECK: .seh_savereg %rsi, 16
movups %xmm8, (%rsp)
.seh_savexmm %xmm8, 0
-# CHECK: .seh_savexmm 8, 0
+# CHECK: .seh_savexmm %xmm8, 0
+ .seh_savexmm 8, 0
+# CHECK: .seh_savexmm %xmm8, 0
pushq %rbx
+ .seh_pushreg %rbx
+# CHECK: .seh_pushreg %rbx
.seh_pushreg 3
-# CHECK: .seh_pushreg 3
+# CHECK: .seh_pushreg %rbx
mov %rsp, %rbx
.seh_setframe 3, 0
+# CHECK: .seh_setframe %rbx, 0
.seh_endprologue
+# CHECK: .seh_endprologue
.seh_handler __C_specific_handler, @except
+# CHECK: .seh_handler __C_specific_handler, @except
.seh_handlerdata
+# CHECK-NOT: .section{{.*}}.xdata
+# CHECK: .seh_handlerdata
.long 0
.text
.seh_startchained
.seh_endprologue
.seh_endchained
-# CHECK: .seh_setframe 3, 0
-# CHECK: .seh_endprologue
-# CHECK: .seh_handler __C_specific_handler, @except
-# CHECK-NOT: .section{{.*}}.xdata
-# CHECK: .seh_handlerdata
# CHECK: .text
# CHECK: .seh_startchained
# CHECK: .seh_endprologue
# RUN: not llvm-mc -triple x86_64-windows-msvc %s -filetype=obj -o /dev/null 2>&1 | FileCheck %s --implicit-check-not=error:
.text
- .seh_pushreg 6
+ .seh_pushreg %rsi
# CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: .seh_ directive must appear within an active frame
.seh_stackalloc 32
f: # @f
.seh_proc f
pushq %rsi
- .seh_pushreg 6
+ .seh_pushreg %rsi
pushq %rdi
- .seh_pushreg 7
+ .seh_pushreg %rdi
pushq %rbx
- .seh_pushreg 3
+ .seh_pushreg %rbx
subq $32, %rsp
.seh_stackalloc 0
# CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: stack allocation size must be non-zero
.seh_endproc
- .seh_pushreg 6
+ .seh_pushreg %rsi
# CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: .seh_ directive must appear within an active frame
g:
.seh_proc g
pushq %rbp
- .seh_pushreg 3
+ .seh_pushreg %rbx
pushq %rsi
- .seh_pushreg 6
+ .seh_pushreg %rsi
.seh_endprologue
.seh_setframe 3 255
# CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: you must specify a stack pointer offset
movaps %xmm7, 48(%rsp) # 16-byte Spill
.seh_savexmm 7 44
# CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: you must specify an offset on the stack
- .seh_savexmm 7, 44
+ .seh_savexmm %xmm7, 44
# CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: offset is not a multiple of 16
- .seh_savexmm 7, 48
+ .seh_savexmm %xmm7, 48
movaps %xmm6, 32(%rsp) # 16-byte Spill
- .seh_savexmm 6, 32
+ .seh_savexmm %xmm6, 32
.seh_endprologue
movapd %xmm0, %xmm6
callq getdbl
.text
.seh_endproc
# -- End function
+
+ .globl i
+ .def i; .scl 2; .type 32; .endef
+ .p2align 4, 0x90
+i:
+ .seh_proc i
+ pushq %rbp
+ .seh_pushreg 17
+# CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: incorrect register number for use with this directive
+ pushq %rbx
+ .seh_pushreg %xmm0
+# CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: register is not supported for use with this directive
+ leaq 16(%rsp), %rbp
+ .seh_setframe %xmm0, 16
+# CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: register is not supported for use with this directive
+ .seh_endprologue
+ ret
+ .seh_endproc
.def func; .scl 2; .type 32; .endef
.seh_proc func
push %r12
- .seh_pushreg 12
+ .seh_pushreg %r12
push %r13
- .seh_pushreg 13
+ .seh_pushreg %r13
.seh_handler __C_specific_handler, @except, @unwind
.seh_handlerdata
.long 0xcafebabe
# %bb.0: # %entry
pushq %rbp
.Ltmp1:
- .seh_pushreg 5
+ .seh_pushreg %rbp
movq %rsp, %rbp
.Ltmp2:
- .seh_setframe 5, 0
+ .seh_setframe %rbp, 0
.Ltmp3:
.seh_endprologue
xorl %eax, %eax
movups %xmm8, (%rsp)
.seh_savexmm %xmm8, 0
pushq %rbx
- .seh_pushreg 3
+ .seh_pushreg %rbx
mov %rsp, %rbx
.seh_setframe 3, 0
.seh_endprologue
movups %xmm8, (%rsp)
.seh_savexmm %xmm8, 0
pushq %rbx
- .seh_pushreg 3
+ .seh_pushreg %rbx
mov %rsp, %rbx
.seh_setframe 3, 0
.seh_endprologue