- // If this operand is a constant, emit the code to copy the constant into
- // the register here...
- //
- if (GlobalValue *GV = dyn_cast<GlobalValue>(V)) {
- // GV is located at PC + distance
- unsigned CurPC = makeAnotherReg(Type::IntTy);
- unsigned Reg1 = makeAnotherReg(V->getType());
- unsigned Reg2 = makeAnotherReg(V->getType());
- // Move PC to destination reg
- BuildMI(*MBB, IPt, PPC32::MovePCtoLR, 0, CurPC);
- // Move value at PC + distance into return reg
- BuildMI(*MBB, IPt, PPC32::LOADHiAddr, 2, Reg1).addReg(CurPC)
- .addGlobalAddress(GV);
- BuildMI(*MBB, IPt, PPC32::LOADLoAddr, 2, Reg2).addReg(Reg1)
- .addGlobalAddress(GV);
- return Reg2;
- } else if (Constant *C = dyn_cast<Constant>(V)) {