mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
d7802bf0dd
on 64-bit PowerPC ELF. The patch includes code to handle external assembly and MC output with the integrated assembler. It intentionally does not support the "old" JIT. For the initial-exec TLS model, the ABI requires the following to calculate the address of external thread-local variable x: Code sequence Relocation Symbol ld 9,x@got@tprel(2) R_PPC64_GOT_TPREL16_DS x add 9,9,x@tls R_PPC64_TLS x The register 9 is arbitrary here. The linker will replace x@got@tprel with the offset relative to the thread pointer to the generated GOT entry for symbol x. It will replace x@tls with the thread-pointer register (13). The two test cases verify correct assembly output and relocation output as just described. PowerPC-specific selection node variants are added for the two instructions above: LD_GOT_TPREL and ADD_TLS. These are inserted when an initial-exec global variable is encountered by PPCTargetLowering::LowerGlobalTLSAddress(), and later lowered to machine instructions LDgotTPREL and ADD8TLS. LDgotTPREL is a pseudo that uses the same LDrs support added for medium code model's LDtocL, with a different relocation type. The rest of the processing is straightforward. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169281 91177308-0d34-0410-b5e6-96231b3b80d8
84 lines
2.7 KiB
C++
84 lines
2.7 KiB
C++
//===-- PPC.h - Top-level interface for PowerPC Target ----------*- C++ -*-===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This file contains the entry points for global functions defined in the LLVM
|
|
// PowerPC back-end.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef LLVM_TARGET_POWERPC_H
|
|
#define LLVM_TARGET_POWERPC_H
|
|
|
|
#include "MCTargetDesc/PPCBaseInfo.h"
|
|
#include "MCTargetDesc/PPCMCTargetDesc.h"
|
|
#include <string>
|
|
|
|
// GCC #defines PPC on Linux but we use it as our namespace name
|
|
#undef PPC
|
|
|
|
namespace llvm {
|
|
class PPCTargetMachine;
|
|
class FunctionPass;
|
|
class JITCodeEmitter;
|
|
class MachineInstr;
|
|
class AsmPrinter;
|
|
class MCInst;
|
|
|
|
FunctionPass *createPPCCTRLoops();
|
|
FunctionPass *createPPCBranchSelectionPass();
|
|
FunctionPass *createPPCISelDag(PPCTargetMachine &TM);
|
|
FunctionPass *createPPCJITCodeEmitterPass(PPCTargetMachine &TM,
|
|
JITCodeEmitter &MCE);
|
|
void LowerPPCMachineInstrToMCInst(const MachineInstr *MI, MCInst &OutMI,
|
|
AsmPrinter &AP, bool isDarwin);
|
|
|
|
namespace PPCII {
|
|
|
|
/// Target Operand Flag enum.
|
|
enum TOF {
|
|
//===------------------------------------------------------------------===//
|
|
// PPC Specific MachineOperand flags.
|
|
MO_NO_FLAG,
|
|
|
|
/// MO_DARWIN_STUB - On a symbol operand "FOO", this indicates that the
|
|
/// reference is actually to the "FOO$stub" symbol. This is used for calls
|
|
/// and jumps to external functions on Tiger and earlier.
|
|
MO_DARWIN_STUB = 1,
|
|
|
|
/// MO_PIC_FLAG - If this bit is set, the symbol reference is relative to
|
|
/// the function's picbase, e.g. lo16(symbol-picbase).
|
|
MO_PIC_FLAG = 4,
|
|
|
|
/// MO_NLP_FLAG - If this bit is set, the symbol reference is actually to
|
|
/// the non_lazy_ptr for the global, e.g. lo16(symbol$non_lazy_ptr-picbase).
|
|
MO_NLP_FLAG = 8,
|
|
|
|
/// MO_NLP_HIDDEN_FLAG - If this bit is set, the symbol reference is to a
|
|
/// symbol with hidden visibility. This causes a different kind of
|
|
/// non-lazy-pointer to be generated.
|
|
MO_NLP_HIDDEN_FLAG = 16,
|
|
|
|
/// The next are not flags but distinct values.
|
|
MO_ACCESS_MASK = 0xe0,
|
|
|
|
/// MO_LO16, MO_HA16 - lo16(symbol) and ha16(symbol)
|
|
MO_LO16 = 1 << 5,
|
|
MO_HA16 = 2 << 5,
|
|
|
|
MO_TPREL16_HA = 3 << 5,
|
|
MO_TPREL16_LO = 4 << 5,
|
|
MO_GOT_TPREL16_DS = 5 << 5,
|
|
MO_TLS = 6 << 5
|
|
};
|
|
} // end namespace PPCII
|
|
|
|
} // end namespace llvm;
|
|
|
|
#endif
|