Go to the documentation of this file.
36 #define DEBUG_TYPE "ppc-tls-dynamic-call"
50 bool NeedFence =
true;
60 if (
MI.getOpcode() != PPC::ADDItlsgdLADDR &&
61 MI.getOpcode() != PPC::ADDItlsldLADDR &&
62 MI.getOpcode() != PPC::ADDItlsgdLADDR32 &&
63 MI.getOpcode() != PPC::ADDItlsldLADDR32 &&
64 MI.getOpcode() != PPC::TLSGDAIX &&
65 MI.getOpcode() != PPC::TLSGDAIX8 && !IsPCREL) {
70 if (
MI.getOpcode() == PPC::ADJCALLSTACKDOWN)
72 else if (
MI.getOpcode() == PPC::ADJCALLSTACKUP)
83 Register GPR3 = Is64Bit ? PPC::X3 : PPC::R3;
86 InReg =
MI.getOperand(1).getReg();
90 switch (
MI.getOpcode()) {
93 case PPC::ADDItlsgdLADDR:
94 Opc1 = PPC::ADDItlsgdL;
95 Opc2 = PPC::GETtlsADDR;
97 case PPC::ADDItlsldLADDR:
98 Opc1 = PPC::ADDItlsldL;
99 Opc2 = PPC::GETtlsldADDR;
101 case PPC::ADDItlsgdLADDR32:
102 Opc1 = PPC::ADDItlsgdL32;
103 Opc2 = PPC::GETtlsADDR32;
105 case PPC::ADDItlsldLADDR32:
106 Opc1 = PPC::ADDItlsldL32;
107 Opc2 = PPC::GETtlsldADDR32;
112 Opc2 = PPC::GETtlsADDR64AIX;
117 Opc2 = PPC::GETtlsADDR32AIX;
120 assert(IsPCREL &&
"Expecting General/Local Dynamic PCRel");
121 Opc1 = PPC::PADDI8pc;
122 Opc2 =
MI.getOperand(2).getTargetFlags() ==
124 ? PPC::GETtlsADDRPCREL
125 : PPC::GETtlsldADDRPCREL;
152 assert(InReg != PPC::NoRegister &&
"Operand must be a register");
161 Call->addOperand(
MI.getOperand(2));
163 Call->addOperand(
MI.getOperand(3));
173 MI.removeFromParent();
183 return (
MI.getOpcode() == PPC::PADDI8pc) &&
184 (
MI.getOperand(2).getTargetFlags() ==
186 MI.getOperand(2).getTargetFlags() ==
193 bool Changed =
false;
211 "PowerPC TLS Dynamic Call Fixup",
false,
false)
217 char PPCTLSDynamicCall::
ID = 0;
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
This is an optimization pass for GlobalISel generic memory operations.
@ MO_GOT_TLSLD_PCREL_FLAG
MO_GOT_TLSLD_PCREL_FLAG - A combintaion of flags, if these bits are set they should produce the reloc...
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
@ MO_GOT_TLSGD_PCREL_FLAG
MO_GOT_TLSGD_PCREL_FLAG - A combintaion of flags, if these bits are set they should produce the reloc...
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
Represent the analysis usage information of a pass.
const HexagonInstrInfo * TII
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
INITIALIZE_PASS_BEGIN(PPCTLSDynamicCall, DEBUG_TYPE, "PowerPC TLS Dynamic Call Fixup", false, false) INITIALIZE_PASS_END(PPCTLSDynamicCall
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
Representation of each machine instruction.
INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
FunctionPass * createPPCTLSDynamicCallPass()
iterator_range< early_inc_iterator_impl< detail::IterOfRange< RangeT > > > make_early_inc_range(RangeT &&Range)
Make a range that does early increment to allow mutation of the underlying range without disrupting i...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
const MachineInstrBuilder & addReg(Register RegNo, unsigned flags=0, unsigned SubReg=0) const
Add a new virtual register operand.
void initializePPCTLSDynamicCallPass(PassRegistry &)
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Wrapper class representing virtual and physical registers.
MachineInstrBuilder BuildMI(MachineFunction &MF, const MIMetadata &MIMD, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
void addOperand(MachineFunction &MF, const MachineOperand &Op)
Add the specified operand to the instruction.
bool isPCREL(unsigned Opcode)
FunctionPass class - This class is used to implement most global optimizations.
AnalysisUsage & addRequired()