llvm.org GIT mirror llvm / fd2fb48
ARM: support expanding external symbols in 32-bit moves This enhances the expansion of the mov32imm pseudo-instruction to support an external symbol reference. This is motivated by a simplification of the stack probe emission for Windows on ARM (and fixing a leak). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207736 91177308-0d34-0410-b5e6-96231b3b80d8 Saleem Abdulrasool 6 years ago
1 changed file(s) with 14 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
704704 .addReg(DstReg, RegState::Define | getDeadRegState(DstIsDead))
705705 .addReg(DstReg);
706706
707 if (MO.isImm()) {
707 switch (MO.getType()) {
708 case MachineOperand::MO_Immediate: {
708709 unsigned Imm = MO.getImm();
709710 unsigned Lo16 = Imm & 0xffff;
710711 unsigned Hi16 = (Imm >> 16) & 0xffff;
711712 LO16 = LO16.addImm(Lo16);
712713 HI16 = HI16.addImm(Hi16);
713 } else {
714 break;
715 }
716 case MachineOperand::MO_ExternalSymbol: {
717 const char *ES = MO.getSymbolName();
718 unsigned TF = MO.getTargetFlags();
719 LO16 = LO16.addExternalSymbol(ES, TF | ARMII::MO_LO16);
720 HI16 = HI16.addExternalSymbol(ES, TF | ARMII::MO_HI16);
721 break;
722 }
723 default: {
714724 const GlobalValue *GV = MO.getGlobal();
715725 unsigned TF = MO.getTargetFlags();
716726 LO16 = LO16.addGlobalAddress(GV, MO.getOffset(), TF | ARMII::MO_LO16);
717727 HI16 = HI16.addGlobalAddress(GV, MO.getOffset(), TF | ARMII::MO_HI16);
728 break;
729 }
718730 }
719731
720732 LO16->setMemRefs(MI.memoperands_begin(), MI.memoperands_end());