Skip to content

Commit

Permalink
Merged master:a8a048ac725 into amd-gfx:1f4f0bca85c
Browse files Browse the repository at this point in the history
Local branch amd-gfx 1f4f0bc Merged master:0231227e5d8 into amd-gfx:5c3fdab71ab
Remote branch master a8a048a Restrict test for DW_AT_APPLE_optimized to Darwin
  • Loading branch information
Sw authored and Sw committed May 22, 2020
2 parents 1f4f0bc + a8a048a commit da21a0b
Show file tree
Hide file tree
Showing 28 changed files with 99 additions and 47 deletions.
9 changes: 8 additions & 1 deletion lldb/include/lldb/Target/Process.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ class ProcessProperties : public Properties {
bool GetDetachKeepsStopped() const;
void SetDetachKeepsStopped(bool keep_stopped);
bool GetWarningsOptimization() const;
bool GetWarningsUnsupportedLanguage() const;
bool GetStopOnExec() const;
std::chrono::seconds GetUtilityExpressionTimeout() const;
bool GetOSPluginReportsAllThreads() const;
Expand Down Expand Up @@ -390,7 +391,7 @@ class Process : public std::enable_shared_from_this<Process>,
};

/// Process warning types.
enum Warnings { eWarningsOptimization = 1 };
enum Warnings { eWarningsOptimization = 1, eWarningsUnsupportedLanguage = 2 };

typedef Range<lldb::addr_t, lldb::addr_t> LoadRange;
// We use a read/write lock to allow on or more clients to access the process
Expand Down Expand Up @@ -1319,6 +1320,12 @@ class Process : public std::enable_shared_from_this<Process>,
/// pre-computed.
void PrintWarningOptimization(const SymbolContext &sc);

/// Print a user-visible warning about a function written in a
/// language that this version of LLDB doesn't support.
///
/// \see PrintWarningOptimization
void PrintWarningUnsupportedLanguage(const SymbolContext &sc);

virtual bool GetProcessInfo(ProcessInstanceInfo &info);

public:
Expand Down
35 changes: 30 additions & 5 deletions lldb/source/Target/Process.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,12 @@ bool ProcessProperties::GetWarningsOptimization() const {
nullptr, idx, g_process_properties[idx].default_uint_value != 0);
}

bool ProcessProperties::GetWarningsUnsupportedLanguage() const {
const uint32_t idx = ePropertyWarningUnsupportedLanguage;
return m_collection_sp->GetPropertyAtIndexAsBoolean(
nullptr, idx, g_process_properties[idx].default_uint_value != 0);
}

bool ProcessProperties::GetStopOnExec() const {
const uint32_t idx = ePropertyStopOnExec;
return m_collection_sp->GetPropertyAtIndexAsBoolean(
Expand Down Expand Up @@ -5779,9 +5785,6 @@ void Process::PrintWarning(uint64_t warning_type, const void *repeat_key,
StreamSP stream_sp = GetTarget().GetDebugger().GetAsyncOutputStream();
if (!stream_sp)
return;
if (warning_type == eWarningsOptimization && !GetWarningsOptimization()) {
return;
}

if (repeat_key != nullptr) {
WarningsCollection::iterator it = m_warnings_issued.find(warning_type);
Expand All @@ -5806,8 +5809,11 @@ void Process::PrintWarning(uint64_t warning_type, const void *repeat_key,
}

void Process::PrintWarningOptimization(const SymbolContext &sc) {
if (GetWarningsOptimization() && sc.module_sp &&
!sc.module_sp->GetFileSpec().GetFilename().IsEmpty() && sc.function &&
if (!GetWarningsOptimization())
return;
if (!sc.module_sp)
return;
if (!sc.module_sp->GetFileSpec().GetFilename().IsEmpty() && sc.function &&
sc.function->GetIsOptimized()) {
PrintWarning(Process::Warnings::eWarningsOptimization, sc.module_sp.get(),
"%s was compiled with optimization - stepping may behave "
Expand All @@ -5816,6 +5822,25 @@ void Process::PrintWarningOptimization(const SymbolContext &sc) {
}
}

void Process::PrintWarningUnsupportedLanguage(const SymbolContext &sc) {
if (!GetWarningsUnsupportedLanguage())
return;
if (!sc.module_sp)
return;
LanguageType language = sc.GetLanguage();
if (language == eLanguageTypeUnknown)
return;
auto type_system_or_err = sc.module_sp->GetTypeSystemForLanguage(language);
if (auto err = type_system_or_err.takeError()) {
llvm::consumeError(std::move(err));
PrintWarning(Process::Warnings::eWarningsUnsupportedLanguage,
sc.module_sp.get(),
"This version of LLDB has no plugin for the %s language. "
"Inspection of frame variables will be limited.\n",
Language::GetNameForLanguageType(language));
}
}

bool Process::GetProcessInfo(ProcessInstanceInfo &info) {
info.Clear();

Expand Down
3 changes: 3 additions & 0 deletions lldb/source/Target/TargetProperties.td
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,9 @@ let Definition = "process" in {
def WarningOptimization: Property<"optimization-warnings", "Boolean">,
DefaultTrue,
Desc<"If true, warn when stopped in code that is optimized where stepping and variable availability may not behave as expected.">;
def WarningUnsupportedLanguage: Property<"unsupported-language-warnings", "Boolean">,
DefaultTrue,
Desc<"If true, warn when stopped in code that is written in a source language that LLDB does not support.">;
def StopOnExec: Property<"stop-on-exec", "Boolean">,
Global,
DefaultTrue,
Expand Down
5 changes: 4 additions & 1 deletion lldb/source/Target/Thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -326,10 +326,13 @@ void Thread::FrameSelectedCallback(StackFrame *frame) {
if (!frame)
return;

if (frame->HasDebugInformation() && GetProcess()->GetWarningsOptimization()) {
if (frame->HasDebugInformation() &&
(GetProcess()->GetWarningsOptimization() ||
GetProcess()->GetWarningsUnsupportedLanguage())) {
SymbolContext sc =
frame->GetSymbolContext(eSymbolContextFunction | eSymbolContextModule);
GetProcess()->PrintWarningOptimization(sc);
GetProcess()->PrintWarningUnsupportedLanguage(sc);
}
}

Expand Down
3 changes: 3 additions & 0 deletions lldb/test/Shell/Process/Inputs/true.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
int main(int argc, char **argv) {
return 0;
}
6 changes: 6 additions & 0 deletions lldb/test/Shell/Process/Optimization.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Test warnings.
REQUIRES: shell, system-darwin
RUN: %clang_host -O3 %S/Inputs/true.c -std=c99 -g -o %t.exe
RUN: %lldb -o "b main" -o r -o q -b %t.exe | FileCheck %s

CHECK: compiled with optimization
8 changes: 8 additions & 0 deletions lldb/test/Shell/Process/UnsupportedLanguage.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Test warnings.
REQUIRES: shell
RUN: %clang_host %S/Inputs/true.c -std=c99 -g -c -S -emit-llvm -o - \
RUN: | sed -e 's/DW_LANG_C99/DW_LANG_PLI/g' >%t.ll
RUN: %clang_host %t.ll -g -o %t.exe
RUN: %lldb -o "b main" -o r -o q -b %t.exe | FileCheck %s

CHECK: This version of LLDB has no plugin for the pli language
6 changes: 3 additions & 3 deletions llvm/include/llvm/MC/MCDwarf.h
Original file line number Diff line number Diff line change
Expand Up @@ -482,9 +482,9 @@ class MCCFIInstruction {
public:
/// .cfi_def_cfa defines a rule for computing CFA as: take address from
/// Register and add Offset to it.
static MCCFIInstruction createDefCfa(MCSymbol *L, unsigned Register,
int Offset) {
return MCCFIInstruction(OpDefCfa, L, Register, -Offset, "");
static MCCFIInstruction cfiDefCfa(MCSymbol *L, unsigned Register,
int Offset) {
return MCCFIInstruction(OpDefCfa, L, Register, Offset, "");
}

/// .cfi_def_cfa_register modifies a rule for computing CFA. From now
Expand Down
6 changes: 3 additions & 3 deletions llvm/lib/CodeGen/CFIInstrInserter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class CFIInstrInserter : public MachineFunctionPass {
/// if needed. The negated value is needed when creating CFI instructions that
/// set absolute offset.
int getCorrectCFAOffset(MachineBasicBlock *MBB) {
return -MBBVector[MBB->getNumber()].IncomingCFAOffset;
return MBBVector[MBB->getNumber()].IncomingCFAOffset;
}

void reportCFAError(const MBBCFAInfo &Pred, const MBBCFAInfo &Succ);
Expand Down Expand Up @@ -314,7 +314,7 @@ bool CFIInstrInserter::insertCFIInstrs(MachineFunction &MF) {
// incoming offset and register of this block, add a def_cfa instruction
// with the correct offset and register for this block.
if (PrevMBBInfo->OutgoingCFARegister != MBBInfo.IncomingCFARegister) {
unsigned CFIIndex = MF.addFrameInst(MCCFIInstruction::createDefCfa(
unsigned CFIIndex = MF.addFrameInst(MCCFIInstruction::cfiDefCfa(
nullptr, MBBInfo.IncomingCFARegister, getCorrectCFAOffset(&MBB)));
BuildMI(*MBBInfo.MBB, MBBI, DL, TII->get(TargetOpcode::CFI_INSTRUCTION))
.addCFIIndex(CFIIndex);
Expand All @@ -324,7 +324,7 @@ bool CFIInstrInserter::insertCFIInstrs(MachineFunction &MF) {
} else {
unsigned CFIIndex =
MF.addFrameInst(MCCFIInstruction::createDefCfaOffset(
nullptr, getCorrectCFAOffset(&MBB)));
nullptr, -getCorrectCFAOffset(&MBB)));
BuildMI(*MBBInfo.MBB, MBBI, DL, TII->get(TargetOpcode::CFI_INSTRUCTION))
.addCFIIndex(CFIIndex);
}
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/CodeGen/MIRParser/MIParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2256,9 +2256,8 @@ bool MIParser::parseCFIOperand(MachineOperand &Dest) {
if (parseCFIRegister(Reg) || expectAndConsume(MIToken::comma) ||
parseCFIOffset(Offset))
return true;
// NB: MCCFIInstruction::createDefCfa negates the offset.
CFIIndex =
MF.addFrameInst(MCCFIInstruction::createDefCfa(nullptr, Reg, -Offset));
MF.addFrameInst(MCCFIInstruction::cfiDefCfa(nullptr, Reg, Offset));
break;
case MIToken::kw_cfi_remember_state:
CFIIndex = MF.addFrameInst(MCCFIInstruction::createRememberState(nullptr));
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/MC/MCStreamer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ MCSymbol *MCStreamer::emitCFILabel() {
void MCStreamer::emitCFIDefCfa(int64_t Register, int64_t Offset) {
MCSymbol *Label = emitCFILabel();
MCCFIInstruction Instruction =
MCCFIInstruction::createDefCfa(Label, Register, Offset);
MCCFIInstruction::cfiDefCfa(Label, Register, -Offset);
MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
if (!CurFrame)
return;
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/Target/AArch64/AArch64FrameLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1349,8 +1349,8 @@ void AArch64FrameLowering::emitPrologue(MachineFunction &MF,
if (HasFP) {
// Define the current CFA rule to use the provided FP.
unsigned Reg = RegInfo->getDwarfRegNum(FramePtr, true);
unsigned CFIIndex = MF.addFrameInst(MCCFIInstruction::createDefCfa(
nullptr, Reg, StackGrowth - FixedObject));
unsigned CFIIndex = MF.addFrameInst(
MCCFIInstruction::cfiDefCfa(nullptr, Reg, FixedObject - StackGrowth));
BuildMI(MBB, MBBI, DL, TII->get(TargetOpcode::CFI_INSTRUCTION))
.addCFIIndex(CFIIndex)
.setMIFlags(MachineInstr::FrameSetup);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ static MCAsmInfo *createAArch64MCAsmInfo(const MCRegisterInfo &MRI,

// Initial state of the frame pointer is SP.
unsigned Reg = MRI.getDwarfRegNum(AArch64::SP, true);
MCCFIInstruction Inst = MCCFIInstruction::createDefCfa(nullptr, Reg, 0);
MCCFIInstruction Inst = MCCFIInstruction::cfiDefCfa(nullptr, Reg, 0);
MAI->addInitialFrameState(Inst);

return MAI;
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Target/ARC/MCTargetDesc/ARCMCTargetDesc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ static MCAsmInfo *createARCMCAsmInfo(const MCRegisterInfo &MRI,
MCAsmInfo *MAI = new ARCMCAsmInfo(TT);

// Initial state of the frame pointer is SP.
MCCFIInstruction Inst = MCCFIInstruction::createDefCfa(nullptr, ARC::SP, 0);
MCCFIInstruction Inst = MCCFIInstruction::cfiDefCfa(nullptr, ARC::SP, 0);
MAI->addInitialFrameState(Inst);

return MAI;
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/Target/ARM/ARMFrameLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -593,9 +593,9 @@ void ARMFrameLowering::emitPrologue(MachineFunction &MF,
PushSize + FramePtrOffsetInPush,
MachineInstr::FrameSetup);
if (FramePtrOffsetInPush + PushSize != 0) {
unsigned CFIIndex = MF.addFrameInst(MCCFIInstruction::createDefCfa(
unsigned CFIIndex = MF.addFrameInst(MCCFIInstruction::cfiDefCfa(
nullptr, MRI->getDwarfRegNum(FramePtr, true),
-(FPCXTSaveSize + ArgRegsSaveSize - FramePtrOffsetInPush)));
FPCXTSaveSize + ArgRegsSaveSize - FramePtrOffsetInPush));
BuildMI(MBB, AfterPush, dl, TII.get(TargetOpcode::CFI_INSTRUCTION))
.addCFIIndex(CFIIndex)
.setMIFlags(MachineInstr::FrameSetup);
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ static MCAsmInfo *createARMMCAsmInfo(const MCRegisterInfo &MRI,
MAI = new ARMELFMCAsmInfo(TheTriple);

unsigned Reg = MRI.getDwarfRegNum(ARM::SP, true);
MAI->addInitialFrameState(MCCFIInstruction::createDefCfa(nullptr, Reg, 0));
MAI->addInitialFrameState(MCCFIInstruction::cfiDefCfa(nullptr, Reg, 0));

return MAI;
}
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/Target/ARM/Thumb1FrameLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,8 @@ void Thumb1FrameLowering::emitPrologue(MachineFunction &MF,
.add(predOps(ARMCC::AL));
if(FramePtrOffsetInBlock) {
CFAOffset += FramePtrOffsetInBlock;
unsigned CFIIndex = MF.addFrameInst(MCCFIInstruction::createDefCfa(
nullptr, MRI->getDwarfRegNum(FramePtr, true), CFAOffset));
unsigned CFIIndex = MF.addFrameInst(MCCFIInstruction::cfiDefCfa(
nullptr, MRI->getDwarfRegNum(FramePtr, true), -CFAOffset));
BuildMI(MBB, MBBI, dl, TII.get(TargetOpcode::CFI_INSTRUCTION))
.addCFIIndex(CFIIndex)
.setMIFlags(MachineInstr::FrameSetup);
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/Target/Hexagon/HexagonFrameLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1056,9 +1056,9 @@ void HexagonFrameLowering::insertCFIInstructionsAt(MachineBasicBlock &MBB,
// | +-- Old SP (before allocframe)
// +-- New FP (after allocframe)
//
// MCCFIInstruction::createDefCfa subtracts the offset from the register.
// MCCFIInstruction::cfiDefCfa adds the offset from the register.
// MCCFIInstruction::createOffset takes the offset without sign change.
auto DefCfa = MCCFIInstruction::createDefCfa(FrameLabel, DwFPReg, -8);
auto DefCfa = MCCFIInstruction::cfiDefCfa(FrameLabel, DwFPReg, 8);
BuildMI(MBB, At, DL, CFID)
.addCFIIndex(MF.addFrameInst(DefCfa));
// R31 (return addr) = CFA - 4
Expand Down
5 changes: 2 additions & 3 deletions llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,8 @@ static MCAsmInfo *createHexagonMCAsmInfo(const MCRegisterInfo &MRI,
MCAsmInfo *MAI = new HexagonMCAsmInfo(TT);

// VirtualFP = (R30 + #0).
MCCFIInstruction Inst =
MCCFIInstruction::createDefCfa(nullptr,
MRI.getDwarfRegNum(Hexagon::R30, true), 0);
MCCFIInstruction Inst = MCCFIInstruction::cfiDefCfa(
nullptr, MRI.getDwarfRegNum(Hexagon::R30, true), 0);
MAI->addInitialFrameState(Inst);

return MAI;
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ static MCAsmInfo *createPPCMCAsmInfo(const MCRegisterInfo &MRI,
// Initial state of the frame pointer is R1.
unsigned Reg = isPPC64 ? PPC::X1 : PPC::R1;
MCCFIInstruction Inst =
MCCFIInstruction::createDefCfa(nullptr, MRI.getDwarfRegNum(Reg, true), 0);
MCCFIInstruction::cfiDefCfa(nullptr, MRI.getDwarfRegNum(Reg, true), 0);
MAI->addInitialFrameState(Inst);

return MAI;
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCTargetDesc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ static MCAsmInfo *createRISCVMCAsmInfo(const MCRegisterInfo &MRI,
MCAsmInfo *MAI = new RISCVMCAsmInfo(TT);

Register SP = MRI.getDwarfRegNum(RISCV::X2, true);
MCCFIInstruction Inst = MCCFIInstruction::createDefCfa(nullptr, SP, 0);
MCCFIInstruction Inst = MCCFIInstruction::cfiDefCfa(nullptr, SP, 0);
MAI->addInitialFrameState(Inst);

return MAI;
Expand Down
6 changes: 3 additions & 3 deletions llvm/lib/Target/RISCV/RISCVFrameLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,9 +329,9 @@ void RISCVFrameLowering::emitPrologue(MachineFunction &MF,
RealStackSize - RVFI->getVarArgsSaveSize(),
MachineInstr::FrameSetup);

// Emit ".cfi_def_cfa $fp, -RVFI->getVarArgsSaveSize()"
unsigned CFIIndex = MF.addFrameInst(MCCFIInstruction::createDefCfa(
nullptr, RI->getDwarfRegNum(FPReg, true), -RVFI->getVarArgsSaveSize()));
// Emit ".cfi_def_cfa $fp, RVFI->getVarArgsSaveSize()"
unsigned CFIIndex = MF.addFrameInst(MCCFIInstruction::cfiDefCfa(
nullptr, RI->getDwarfRegNum(FPReg, true), RVFI->getVarArgsSaveSize()));
BuildMI(MBB, MBBI, DL, TII->get(TargetOpcode::CFI_INSTRUCTION))
.addCFIIndex(CFIIndex);
}
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/Target/Sparc/MCTargetDesc/SparcMCTargetDesc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ static MCAsmInfo *createSparcMCAsmInfo(const MCRegisterInfo &MRI,
const MCTargetOptions &Options) {
MCAsmInfo *MAI = new SparcELFMCAsmInfo(TT);
unsigned Reg = MRI.getDwarfRegNum(SP::O6, true);
MCCFIInstruction Inst = MCCFIInstruction::createDefCfa(nullptr, Reg, 0);
MCCFIInstruction Inst = MCCFIInstruction::cfiDefCfa(nullptr, Reg, 0);
MAI->addInitialFrameState(Inst);
return MAI;
}
Expand All @@ -47,7 +47,7 @@ static MCAsmInfo *createSparcV9MCAsmInfo(const MCRegisterInfo &MRI,
const MCTargetOptions &Options) {
MCAsmInfo *MAI = new SparcELFMCAsmInfo(TT);
unsigned Reg = MRI.getDwarfRegNum(SP::O6, true);
MCCFIInstruction Inst = MCCFIInstruction::createDefCfa(nullptr, Reg, 2047);
MCCFIInstruction Inst = MCCFIInstruction::cfiDefCfa(nullptr, Reg, -2047);
MAI->addInitialFrameState(Inst);
return MAI;
}
Expand Down
7 changes: 3 additions & 4 deletions llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCTargetDesc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,9 @@ static MCAsmInfo *createSystemZMCAsmInfo(const MCRegisterInfo &MRI,
const Triple &TT,
const MCTargetOptions &Options) {
MCAsmInfo *MAI = new SystemZMCAsmInfo(TT);
MCCFIInstruction Inst =
MCCFIInstruction::createDefCfa(nullptr,
MRI.getDwarfRegNum(SystemZ::R15D, true),
SystemZMC::CFAOffsetFromInitialSP);
MCCFIInstruction Inst = MCCFIInstruction::cfiDefCfa(
nullptr, MRI.getDwarfRegNum(SystemZ::R15D, true),
-SystemZMC::CFAOffsetFromInitialSP);
MAI->addInitialFrameState(Inst);
return MAI;
}
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Target/VE/MCTargetDesc/VEMCTargetDesc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ static MCAsmInfo *createVEMCAsmInfo(const MCRegisterInfo &MRI, const Triple &TT,
const MCTargetOptions &Options) {
MCAsmInfo *MAI = new VEELFMCAsmInfo(TT);
unsigned Reg = MRI.getDwarfRegNum(VE::SX11, true);
MCCFIInstruction Inst = MCCFIInstruction::createDefCfa(nullptr, Reg, 0);
MCCFIInstruction Inst = MCCFIInstruction::cfiDefCfa(nullptr, Reg, 0);
MAI->addInitialFrameState(Inst);
return MAI;
}
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,8 @@ static MCAsmInfo *createX86MCAsmInfo(const MCRegisterInfo &MRI,

// Initial state of the frame pointer is esp+stackGrowth.
unsigned StackPtr = is64Bit ? X86::RSP : X86::ESP;
MCCFIInstruction Inst = MCCFIInstruction::createDefCfa(
nullptr, MRI.getDwarfRegNum(StackPtr, true), -stackGrowth);
MCCFIInstruction Inst = MCCFIInstruction::cfiDefCfa(
nullptr, MRI.getDwarfRegNum(StackPtr, true), stackGrowth);
MAI->addInitialFrameState(Inst);

// Add return address to move list
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/Target/X86/X86FrameLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1842,8 +1842,8 @@ void X86FrameLowering::emitEpilogue(MachineFunction &MF,
if (NeedsDwarfCFI) {
unsigned DwarfStackPtr =
TRI->getDwarfRegNum(Is64Bit ? X86::RSP : X86::ESP, true);
BuildCFI(MBB, MBBI, DL, MCCFIInstruction::createDefCfa(
nullptr, DwarfStackPtr, -SlotSize));
BuildCFI(MBB, MBBI, DL,
MCCFIInstruction::cfiDefCfa(nullptr, DwarfStackPtr, SlotSize));
if (!MBB.succ_empty() && !MBB.isReturnBlock()) {
unsigned DwarfFramePtr = TRI->getDwarfRegNum(MachineFramePtr, true);
BuildCFI(MBB, AfterPop, DL,
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Target/XCore/MCTargetDesc/XCoreMCTargetDesc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ static MCAsmInfo *createXCoreMCAsmInfo(const MCRegisterInfo &MRI,
MCAsmInfo *MAI = new XCoreMCAsmInfo(TT);

// Initial state of the frame pointer is SP.
MCCFIInstruction Inst = MCCFIInstruction::createDefCfa(nullptr, XCore::SP, 0);
MCCFIInstruction Inst = MCCFIInstruction::cfiDefCfa(nullptr, XCore::SP, 0);
MAI->addInitialFrameState(Inst);

return MAI;
Expand Down

0 comments on commit da21a0b

Please sign in to comment.