static MCAsmInfo *createARMMCAsmInfo(const MCRegisterInfo &MRI, StringRef TT) { Triple TheTriple(TT); MCAsmInfo *MAI; switch (TheTriple.getOS()) { case llvm::Triple::Darwin: case llvm::Triple::IOS: case llvm::Triple::MacOSX: MAI = new ARMMCAsmInfoDarwin(TT); break; case llvm::Triple::Win32: switch (TheTriple.getEnvironment()) { case llvm::Triple::Itanium: MAI = new ARMCOFFMCAsmInfoGNU(); break; case llvm::Triple::MSVC: MAI = new ARMCOFFMCAsmInfoMicrosoft(); break; default: llvm_unreachable("invalid environment"); } break; default: if (TheTriple.isOSBinFormatMachO()) MAI = new ARMMCAsmInfoDarwin(TT); else MAI = new ARMELFMCAsmInfo(TT); break; } unsigned Reg = MRI.getDwarfRegNum(ARM::SP, true); MAI->addInitialFrameState(MCCFIInstruction::createDefCfa(nullptr, Reg, 0)); return MAI; }
static MCAsmInfo *createCpu0MCAsmInfo(const MCRegisterInfo &MRI, StringRef TT) { MCAsmInfo *MAI = new Cpu0MCAsmInfo(TT); unsigned SP = MRI.getDwarfRegNum(Cpu0::SP, true); MCCFIInstruction Inst = MCCFIInstruction::createDefCfa(0, SP, 0); MAI->addInitialFrameState(Inst); return MAI; }
static MCAsmInfo *createSystemZMCAsmInfo(const MCRegisterInfo &MRI, StringRef TT) { MCAsmInfo *MAI = new SystemZMCAsmInfo(TT); MCCFIInstruction Inst = MCCFIInstruction::createDefCfa(0, MRI.getDwarfRegNum(SystemZ::R15D, true), SystemZMC::CFAOffsetFromInitialSP); MAI->addInitialFrameState(Inst); return MAI; }
static MCAsmInfo *createCpu0MCAsmInfo(const Target &T, StringRef TT) { MCAsmInfo *MAI = new Cpu0MCAsmInfo(T, TT); MachineLocation Dst(MachineLocation::VirtualFP); MachineLocation Src(Cpu0::SP, 0); MAI->addInitialFrameState(0, Dst, Src); return MAI; }
static MCAsmInfo *createMipsMCAsmInfo(const MCRegisterInfo &MRI, const Triple &TT) { MCAsmInfo *MAI = new MipsMCAsmInfo(TT); unsigned SP = MRI.getDwarfRegNum(Mips::SP, true); MCCFIInstruction Inst = MCCFIInstruction::createDefCfa(nullptr, SP, 0); MAI->addInitialFrameState(Inst); return MAI; }
static MCAsmInfo *createXCoreMCAsmInfo(const MCRegisterInfo &MRI, const Triple &TT) { MCAsmInfo *MAI = new XCoreMCAsmInfo(TT); // Initial state of the frame pointer is SP. MCCFIInstruction Inst = MCCFIInstruction::createDefCfa(nullptr, XCore::SP, 0); MAI->addInitialFrameState(Inst); return MAI; }
static MCAsmInfo *createVideocoreMCAsmInfo(const Target &T, StringRef TT) { MCAsmInfo *MAI = new VideocoreMCAsmInfo(T, TT); // Initial state of the frame pointer is SP. MachineLocation Dst(MachineLocation::VirtualFP); MachineLocation Src(VC::SP, 0); MAI->addInitialFrameState(0, Dst, Src); return MAI; }
static MCAsmInfo *createSPUMCAsmInfo(const Target &T, StringRef TT) { MCAsmInfo *MAI = new SPULinuxMCAsmInfo(T, TT); // Initial state of the frame pointer is R1. MachineLocation Dst(MachineLocation::VirtualFP); MachineLocation Src(SPU::R1, 0); MAI->addInitialFrameState(0, Dst, Src); return MAI; }
static MCAsmInfo *createX86MCAsmInfo(const MCRegisterInfo &MRI, const Triple &TheTriple) { bool is64Bit = TheTriple.getArch() == Triple::x86_64; MCAsmInfo *MAI; if (TheTriple.isOSBinFormatMachO()) { if (is64Bit) MAI = new X86_64MCAsmInfoDarwin(TheTriple); else MAI = new X86MCAsmInfoDarwin(TheTriple); } else if (TheTriple.isOSBinFormatELF()) { // Force the use of an ELF container. MAI = new X86ELFMCAsmInfo(TheTriple); } else if (TheTriple.isWindowsMSVCEnvironment() || TheTriple.isWindowsCoreCLREnvironment()) { MAI = new X86MCAsmInfoMicrosoft(TheTriple); } else if (TheTriple.isOSCygMing() || TheTriple.isWindowsItaniumEnvironment()) { MAI = new X86MCAsmInfoGNUCOFF(TheTriple); } else { // The default is ELF. MAI = new X86ELFMCAsmInfo(TheTriple); } // Initialize initial frame state. // Calculate amount of bytes used for return address storing int stackGrowth = is64Bit ? -8 : -4; // 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); MAI->addInitialFrameState(Inst); // Add return address to move list unsigned InstPtr = is64Bit ? X86::RIP : X86::EIP; MCCFIInstruction Inst2 = MCCFIInstruction::createOffset( nullptr, MRI.getDwarfRegNum(InstPtr, true), stackGrowth); MAI->addInitialFrameState(Inst2); return MAI; }
static MCAsmInfo *createHexagonMCAsmInfo(const MCRegisterInfo &MRI, StringRef TT) { MCAsmInfo *MAI = new HexagonMCAsmInfo(TT); // VirtualFP = (R30 + #0). MCCFIInstruction Inst = MCCFIInstruction::createDefCfa(nullptr, Hexagon::R30, 0); MAI->addInitialFrameState(Inst); return MAI; }
static MCAsmInfo *createAArch64MCAsmInfo(const MCRegisterInfo &MRI, StringRef TT) { Triple TheTriple(TT); MCAsmInfo *MAI = new AArch64ELFMCAsmInfo(); unsigned Reg = MRI.getDwarfRegNum(AArch64::XSP, true); MCCFIInstruction Inst = MCCFIInstruction::createDefCfa(0, Reg, 0); MAI->addInitialFrameState(Inst); return MAI; }
static MCAsmInfo *createNyuziMCAsmInfo(const MCRegisterInfo &MRI, const Triple &TT) { MCAsmInfo *MAI = new NyuziMCAsmInfo(TT); // Put an instruction into the common information entry (CIE), shared // by all frame description entries (FDE), which indicates the stack // pointer register (r29) is used to find the canonical frame address (CFA). unsigned SP = MRI.getDwarfRegNum(Nyuzi::SP_REG, true); MCCFIInstruction Inst = MCCFIInstruction::createDefCfa(nullptr, SP, 0); MAI->addInitialFrameState(Inst); return MAI; }
static MCAsmInfo *createARMMCAsmInfo(const MCRegisterInfo &MRI, StringRef TT) { Triple TheTriple(TT); MCAsmInfo *MAI; if (TheTriple.isOSBinFormatMachO()) MAI = new ARMMCAsmInfoDarwin(); else MAI = new ARMELFMCAsmInfo(); unsigned Reg = MRI.getDwarfRegNum(ARM::SP, true); MAI->addInitialFrameState(MCCFIInstruction::createDefCfa(0, Reg, 0)); return MAI; }
static MCAsmInfo *createARMMCAsmInfo(const MCRegisterInfo &MRI, const Triple &TheTriple) { MCAsmInfo *MAI; if (TheTriple.isOSDarwin() || TheTriple.isOSBinFormatMachO()) MAI = new ARMMCAsmInfoDarwin(TheTriple); else if (TheTriple.isWindowsItaniumEnvironment()) MAI = new ARMCOFFMCAsmInfoGNU(); else if (TheTriple.isWindowsMSVCEnvironment()) MAI = new ARMCOFFMCAsmInfoMicrosoft(); else MAI = new ARMELFMCAsmInfo(TheTriple); unsigned Reg = MRI.getDwarfRegNum(ARM::SP, true); MAI->addInitialFrameState(MCCFIInstruction::createDefCfa(nullptr, Reg, 0)); return MAI; }
static MCAsmInfo *createPPCMCAsmInfo(const Target &T, StringRef TT) { Triple TheTriple(TT); bool isPPC64 = TheTriple.getArch() == Triple::ppc64; MCAsmInfo *MAI; if (TheTriple.isOSDarwin()) MAI = new PPCMCAsmInfoDarwin(isPPC64); else MAI = new PPCLinuxMCAsmInfo(isPPC64); // Initial state of the frame pointer is R1. MachineLocation Dst(MachineLocation::VirtualFP); MachineLocation Src(isPPC64? PPC::X1 : PPC::R1, 0); MAI->addInitialFrameState(0, Dst, Src); return MAI; }
static MCAsmInfo *createPPCMCAsmInfo(const MCRegisterInfo &MRI, StringRef TT) { Triple TheTriple(TT); bool isPPC64 = TheTriple.getArch() == Triple::ppc64; MCAsmInfo *MAI; if (TheTriple.isOSDarwin()) MAI = new PPCMCAsmInfoDarwin(isPPC64); else MAI = new PPCLinuxMCAsmInfo(isPPC64); // Initial state of the frame pointer is R1. unsigned Reg = isPPC64 ? PPC::X1 : PPC::R1; MCCFIInstruction Inst = MCCFIInstruction::createDefCfa(0, MRI.getDwarfRegNum(Reg, true), 0); MAI->addInitialFrameState(Inst); return MAI; }
static MCAsmInfo *createARM64MCAsmInfo(const MCRegisterInfo &MRI, StringRef TT) { Triple TheTriple(TT); MCAsmInfo *MAI; if (TheTriple.isOSDarwin()) MAI = new ARM64MCAsmInfoDarwin(); else { assert(TheTriple.isOSBinFormatELF() && "Only expect Darwin or ELF"); MAI = new ARM64MCAsmInfoELF(); } // Initial state of the frame pointer is SP. unsigned Reg = MRI.getDwarfRegNum(ARM64::SP, true); MCCFIInstruction Inst = MCCFIInstruction::createDefCfa(0, Reg, 0); MAI->addInitialFrameState(Inst); return MAI; }
static MCAsmInfo *createPPCMCAsmInfo(const MCRegisterInfo &MRI, const Triple &TheTriple) { bool isPPC64 = (TheTriple.getArch() == Triple::ppc64 || TheTriple.getArch() == Triple::ppc64le); MCAsmInfo *MAI; if (TheTriple.isOSDarwin()) MAI = new PPCMCAsmInfoDarwin(isPPC64, TheTriple); else MAI = new PPCELFMCAsmInfo(isPPC64, TheTriple); // 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); MAI->addInitialFrameState(Inst); return MAI; }