Changed the CreateCodeToLoadConst function to preserve SSA form. This basically means adding extra tmp instructions for intermediate values.

llvm-svn: 18137
This commit is contained in:
Tanya Lattner 2004-11-23 04:22:29 +00:00
parent 69e4cc55ef
commit c3a7394291
1 changed files with 24 additions and 7 deletions

View File

@ -1111,22 +1111,39 @@ void CreateCodeToLoadConst(const TargetMachine& target, Function* F,
MI->getOperand(0).markHi64(); MI->getOperand(0).markHi64();
mvec.push_back(MI); mvec.push_back(MI);
//Create another tmp register for the SETX sequence to preserve SSA
TmpInstruction* tmpReg2 =
new TmpInstruction(mcfi, PointerType::get(val->getType()));
MI = BuildMI(V9::ORi, 3).addReg(tmpReg).addConstantPoolIndex(CPI) MI = BuildMI(V9::ORi, 3).addReg(tmpReg).addConstantPoolIndex(CPI)
.addRegDef(tmpReg); .addRegDef(tmpReg2);
MI->getOperand(1).markLo64(); MI->getOperand(1).markLo64();
mvec.push_back(MI); mvec.push_back(MI);
mvec.push_back(BuildMI(V9::SLLXi6, 3).addReg(tmpReg).addZImm(32) //Create another tmp register for the SETX sequence to preserve SSA
.addRegDef(tmpReg)); TmpInstruction* tmpReg3 =
new TmpInstruction(mcfi, PointerType::get(val->getType()));
mvec.push_back(BuildMI(V9::SLLXi6, 3).addReg(tmpReg2).addZImm(32)
.addRegDef(tmpReg3));
MI = BuildMI(V9::SETHI, 2).addConstantPoolIndex(CPI).addRegDef(addrReg); MI = BuildMI(V9::SETHI, 2).addConstantPoolIndex(CPI).addRegDef(addrReg);
MI->getOperand(0).markHi32(); MI->getOperand(0).markHi32();
mvec.push_back(MI); mvec.push_back(MI);
MI = BuildMI(V9::ORr, 3).addReg(addrReg).addReg(tmpReg).addRegDef(addrReg); // Create another TmpInstruction for the address register
TmpInstruction* addrReg2 =
new TmpInstruction(mcfi, PointerType::get(val->getType()));
MI = BuildMI(V9::ORr, 3).addReg(addrReg).addReg(tmpReg3).addRegDef(addrReg2);
mvec.push_back(MI); mvec.push_back(MI);
MI = BuildMI(V9::ORi, 3).addReg(addrReg).addConstantPoolIndex(CPI) // Create another TmpInstruction for the address register
.addRegDef(addrReg); TmpInstruction* addrReg3 =
new TmpInstruction(mcfi, PointerType::get(val->getType()));
MI = BuildMI(V9::ORi, 3).addReg(addrReg2).addConstantPoolIndex(CPI)
.addRegDef(addrReg3);
MI->getOperand(1).markLo32(); MI->getOperand(1).markLo32();
mvec.push_back(MI); mvec.push_back(MI);
@ -1134,7 +1151,7 @@ void CreateCodeToLoadConst(const TargetMachine& target, Function* F,
unsigned Opcode = ChooseLoadInstruction(val->getType()); unsigned Opcode = ChooseLoadInstruction(val->getType());
Opcode = convertOpcodeFromRegToImm(Opcode); Opcode = convertOpcodeFromRegToImm(Opcode);
mvec.push_back(BuildMI(Opcode, 3) mvec.push_back(BuildMI(Opcode, 3)
.addReg(addrReg).addSImm((int64_t)0).addRegDef(dest)); .addReg(addrReg3).addSImm((int64_t)0).addRegDef(dest));
} }
} }