mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-15 21:24:00 +00:00
Generate code for TLS instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58141 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -527,6 +527,23 @@ void Emitter::emitInstruction(const MachineInstr &MI,
|
|||||||
case X86::DWARF_LOC:
|
case X86::DWARF_LOC:
|
||||||
case X86::FP_REG_KILL:
|
case X86::FP_REG_KILL:
|
||||||
break;
|
break;
|
||||||
|
case X86::TLS_tp: {
|
||||||
|
MCE.emitByte(BaseOpcode);
|
||||||
|
unsigned RegOpcodeField = getX86RegNum(MI.getOperand(0).getReg());
|
||||||
|
MCE.emitByte(ModRMByte(0, RegOpcodeField, 5));
|
||||||
|
emitConstant(0, 4);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case X86::TLS_gs_ri: {
|
||||||
|
MCE.emitByte(BaseOpcode);
|
||||||
|
unsigned RegOpcodeField = getX86RegNum(MI.getOperand(0).getReg());
|
||||||
|
MCE.emitByte(ModRMByte(0, RegOpcodeField, 5));
|
||||||
|
GlobalValue* GV = MI.getOperand(1).getGlobal();
|
||||||
|
unsigned rt = Is64BitMode ? X86::reloc_pcrel_word
|
||||||
|
: (IsPIC ? X86::reloc_picrel_word : X86::reloc_absolute_word);
|
||||||
|
emitGlobalAddress(GV, rt);
|
||||||
|
break;
|
||||||
|
}
|
||||||
case X86::MOVPC32r: {
|
case X86::MOVPC32r: {
|
||||||
// This emits the "call" portion of this pseudo instruction.
|
// This emits the "call" portion of this pseudo instruction.
|
||||||
MCE.emitByte(BaseOpcode);
|
MCE.emitByte(BaseOpcode);
|
||||||
|
@ -2798,6 +2798,11 @@ static unsigned GetInstSizeWithDesc(const MachineInstr &MI,
|
|||||||
FinalSize += sizeConstant(X86InstrInfo::sizeOfImm(Desc));
|
FinalSize += sizeConstant(X86InstrInfo::sizeOfImm(Desc));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case X86::TLS_tp:
|
||||||
|
case X86::TLS_gs_ri:
|
||||||
|
FinalSize += 2;
|
||||||
|
FinalSize += sizeGlobalAddress(false);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
CurOp = NumOps;
|
CurOp = NumOps;
|
||||||
break;
|
break;
|
||||||
|
@ -2618,14 +2618,15 @@ def TLS_gs_rr : I<0, Pseudo, (outs GR32:$dst), (ins GR32:$src),
|
|||||||
[(set GR32:$dst, (load (add X86TLStp, GR32:$src)))]>;
|
[(set GR32:$dst, (load (add X86TLStp, GR32:$src)))]>;
|
||||||
|
|
||||||
let AddedComplexity = 15 in
|
let AddedComplexity = 15 in
|
||||||
def TLS_gs_ri : I<0, Pseudo, (outs GR32:$dst), (ins i32imm:$src),
|
def TLS_gs_ri : I<0x8B, Pseudo, (outs GR32:$dst), (ins i32imm:$src),
|
||||||
"movl\t%gs:${src:mem}, $dst",
|
"movl\t%gs:${src:mem}, $dst",
|
||||||
[(set GR32:$dst,
|
[(set GR32:$dst,
|
||||||
(load (add X86TLStp, (X86Wrapper tglobaltlsaddr:$src))))]>;
|
(load (add X86TLStp, (X86Wrapper tglobaltlsaddr:$src))))]>,
|
||||||
|
SegGS;
|
||||||
|
|
||||||
def TLS_tp : I<0, Pseudo, (outs GR32:$dst), (ins),
|
def TLS_tp : I<0x8B, Pseudo, (outs GR32:$dst), (ins),
|
||||||
"movl\t%gs:0, $dst",
|
"movl\t%gs:0, $dst",
|
||||||
[(set GR32:$dst, X86TLStp)]>;
|
[(set GR32:$dst, X86TLStp)]>, SegGS;
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// DWARF Pseudo Instructions
|
// DWARF Pseudo Instructions
|
||||||
|
Reference in New Issue
Block a user