30 #define GET_REGINFO_MC_DESC
31 #include "X86GenRegisterInfo.inc"
33 #define GET_INSTRINFO_MC_DESC
34 #include "X86GenInstrInfo.inc"
36 #define GET_SUBTARGETINFO_MC_DESC
37 #include "X86GenSubtargetInfo.inc"
59 unsigned *rEBX,
unsigned *rECX,
unsigned *rEDX) {
60 #if defined(__x86_64__) || defined(_M_AMD64) || defined (_M_X64)
63 asm (
"movq\t%%rbx, %%rsi\n\t"
65 "xchgq\t%%rbx, %%rsi\n\t"
72 #elif defined(_MSC_VER)
74 __cpuid(registers, value);
83 #elif defined(i386) || defined(__i386__) || defined(__x86__) || defined(_M_IX86)
85 asm (
"movl\t%%ebx, %%esi\n\t"
87 "xchgl\t%%ebx, %%esi\n\t"
94 #elif defined(_MSC_VER)
99 mov dword ptr [esi],eax
101 mov dword ptr [esi],ebx
103 mov dword ptr [esi],ecx
105 mov dword ptr [esi],edx
120 unsigned *rEBX,
unsigned *rECX,
unsigned *rEDX) {
121 #if defined(__x86_64__) || defined(_M_AMD64) || defined (_M_X64)
122 #if defined(__GNUC__)
124 asm (
"movq\t%%rbx, %%rsi\n\t"
126 "xchgq\t%%rbx, %%rsi\n\t"
134 #elif defined(_MSC_VER)
136 #if (_MSC_VER > 1500) || (_MSC_VER == 1500 && _MSC_FULL_VER >= 150030729)
138 __cpuidex(registers, value, subleaf);
139 *rEAX = registers[0];
140 *rEBX = registers[1];
141 *rECX = registers[2];
142 *rEDX = registers[3];
150 #elif defined(i386) || defined(__i386__) || defined(__x86__) || defined(_M_IX86)
151 #if defined(__GNUC__)
152 asm (
"movl\t%%ebx, %%esi\n\t"
154 "xchgl\t%%ebx, %%esi\n\t"
162 #elif defined(_MSC_VER)
168 mov dword ptr [esi],eax
170 mov dword ptr [esi],ebx
172 mov dword ptr [esi],ecx
174 mov dword ptr [esi],edx
187 Family = (EAX >> 8) & 0xf;
188 Model = (EAX >> 4) & 0xf;
189 if (Family == 6 || Family == 0xf) {
192 Family += (EAX >> 20) & 0xff;
194 Model += ((EAX >> 16) & 0xf) << 4;
214 for (
unsigned Reg = X86::NoRegister+1;
Reg < X86::NUM_TARGET_REGS; ++
Reg) {
225 ArchFS = ArchFS +
"," + FS.
str();
230 std::string CPUName = CPU;
231 if (CPUName.empty()) {
232 #if defined(i386) || defined(__i386__) || defined(__x86__) || defined(_M_IX86)\
233 || defined(__x86_64__) || defined(_M_AMD64) || defined (_M_X64)
241 InitX86MCSubtargetInfo(X, TT, CPUName, ArchFS);
247 InitX86MCInstrInfo(X);
258 InitX86MCRegisterInfo(X, RA,
290 int stackGrowth = is64Bit ? -8 : -4;
293 unsigned StackPtr = is64Bit ? X86::RSP :
X86::ESP;
299 unsigned InstPtr = is64Bit ? X86::RIP : X86::EIP;
375 unsigned SyntaxVariant,
380 if (SyntaxVariant == 0)
382 if (SyntaxVariant == 1)
OSType getOS() const
getOS - Get the parsed operating system type of this triple.
static MCCodeGenInfo * createX86MCCodeGenInfo(StringRef TT, Reloc::Model RM, CodeModel::Model CM, CodeGenOpt::Level OL)
static MCInstPrinter * createX86MCInstPrinter(const Target &T, unsigned SyntaxVariant, const MCAsmInfo &MAI, const MCInstrInfo &MII, const MCRegisterInfo &MRI, const MCSubtargetInfo &STI)
int getDwarfRegNum(unsigned RegNum, bool isEH) const
Map a target register to an equivalent dwarf register number. Returns -1 if there is no equivalent va...
static void RegisterMCInstrAnalysis(Target &T, Target::MCInstrAnalysisCtorFnTy Fn)
static MCCFIInstruction createOffset(MCSymbol *L, unsigned Register, int Offset)
.cfi_offset Previous value of Register is saved at offset Offset from CFA.
std::string str() const
str - Get the contents as an std::string.
static MCAsmInfo * createX86MCAsmInfo(const MCRegisterInfo &MRI, StringRef TT)
static void RegisterMCInstPrinter(Target &T, Target::MCInstPrinterCtorTy Fn)
static MCRelocationInfo * createX86MCRelocationInfo(StringRef TT, MCContext &Ctx)
MCStreamer * createELFStreamer(MCContext &Ctx, MCTargetStreamer *TargetStreamer, MCAsmBackend &TAB, raw_ostream &OS, MCCodeEmitter *CE, bool RelaxAll, bool NoExecStack)
bool isOSWindows() const
Tests whether the OS is Windows.
MCCodeEmitter * createX86MCCodeEmitter(const MCInstrInfo &MCII, const MCRegisterInfo &MRI, const MCSubtargetInfo &STI, MCContext &Ctx)
MCStreamer * createMachOStreamer(MCContext &Ctx, MCAsmBackend &TAB, raw_ostream &OS, MCCodeEmitter *CE, bool RelaxAll=false)
bool GetCpuIDAndInfo(unsigned value, unsigned *rEAX, unsigned *rEBX, unsigned *rECX, unsigned *rEDX)
static MCRegisterInfo * createX86MCRegisterInfo(StringRef TT)
bool isEnvironmentMachO() const
Tests whether the environment is MachO.
void addInitialFrameState(const MCCFIInstruction &Inst)
MCRelocationInfo * createX86_64ELFRelocationInfo(MCContext &Ctx)
createX86_64ELFORelocationInfo - Construct X86-64 ELF relocation info.
void InitMCCodeGenInfo(Reloc::Model RM=Reloc::Default, CodeModel::Model CM=CodeModel::Default, CodeGenOpt::Level OL=CodeGenOpt::Default)
ArchType getArch() const
getArch - Get the parsed architecture type of this triple.
MCStreamer * createWinCOFFStreamer(MCContext &Ctx, MCAsmBackend &TAB, MCCodeEmitter &CE, raw_ostream &OS, bool RelaxAll=false)
void LLVMInitializeX86TargetMC()
unsigned getDwarfRegFlavour(StringRef TT, bool isEH)
static void RegisterMCAsmBackend(Target &T, Target::MCAsmBackendCtorTy Fn)
static MCCFIInstruction createDefCfa(MCSymbol *L, unsigned Register, int Offset)
.cfi_def_cfa defines a rule for computing CFA as: take address from Register and add Offset to it...
static MCStreamer * createMCStreamer(const Target &T, StringRef TT, MCContext &Ctx, MCAsmBackend &MAB, raw_ostream &_OS, MCCodeEmitter *_Emitter, bool RelaxAll, bool NoExecStack)
static void RegisterMCObjectStreamer(Target &T, Target::MCObjectStreamerCtorTy Fn)
std::string ParseX86Triple(StringRef TT)
MCCodeEmitter - Generic instruction encoding interface.
std::string getHostCPUName()
bool GetCpuIDAndInfoEx(unsigned value, unsigned subleaf, unsigned *rEAX, unsigned *rEBX, unsigned *rECX, unsigned *rEDX)
MCAsmBackend * createX86_32AsmBackend(const Target &T, const MCRegisterInfo &MRI, StringRef TT, StringRef CPU)
Create MCExprs from relocations found in an object file.
MCAsmBackend * createX86_64AsmBackend(const Target &T, const MCRegisterInfo &MRI, StringRef TT, StringRef CPU)
static void RegisterMCSubtargetInfo(Target &T, Target::MCSubtargetInfoCtorFnTy Fn)
void DetectFamilyModel(unsigned EAX, unsigned &Family, unsigned &Model)
MCRelocationInfo * createMCRelocationInfo(StringRef TT, MCContext &Ctx)
bool isOSDarwin() const
isOSDarwin - Is this a "Darwin" OS (OS X or iOS).
void InitLLVM2SEHRegisterMapping(MCRegisterInfo *MRI)
static void RegisterMCCodeEmitter(Target &T, Target::MCCodeEmitterCtorTy Fn)
MCRelocationInfo * createX86_64MachORelocationInfo(MCContext &Ctx)
createX86_64MachORelocationInfo - Construct X86-64 Mach-O relocation info.
static void RegisterMCRegInfo(Target &T, Target::MCRegInfoCtorFnTy Fn)
static MCInstrInfo * createX86MCInstrInfo()
bool isOSBinFormatELF() const
Tests whether the OS uses the ELF binary format.
static void RegisterMCInstrInfo(Target &T, Target::MCInstrInfoCtorFnTy Fn)
MCSubtargetInfo * createX86MCSubtargetInfo(StringRef TT, StringRef CPU, StringRef FS)
EnvironmentType getEnvironment() const
getEnvironment - Get the parsed environment type of this triple.
uint16_t getEncodingValue(unsigned RegNo) const
Returns the encoding for RegNo.
MCAsmBackend - Generic interface to target specific assembler backends.
cl::opt< bool > RelaxAll("mc-relax-all", cl::desc("When used with filetype=obj, ""relax all fixups in the emitted object file"))
static void RegisterMCRelocationInfo(Target &T, Target::MCRelocationInfoCtorTy Fn)
const MCRegisterInfo & MRI
static MCInstrAnalysis * createX86MCInstrAnalysis(const MCInstrInfo *Info)
static RegisterPass< NVPTXAllocaHoisting > X("alloca-hoisting","Hoisting alloca instructions in non-entry ""blocks to the entry block")
void mapLLVMRegToSEHReg(unsigned LLVMReg, int SEHReg)
bool empty() const
empty - Check if the string is empty.