[llvm] 675c748 - [Mips] clang-format prescanForConstants (NFC)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Sun Aug 25 12:18:40 PDT 2024
Author: Kazu Hirata
Date: 2024-08-25T12:18:33-07:00
New Revision: 675c748bb606d75a959481e6014299849cf3094c
URL: https://github.com/llvm/llvm-project/commit/675c748bb606d75a959481e6014299849cf3094c
DIFF: https://github.com/llvm/llvm-project/commit/675c748bb606d75a959481e6014299849cf3094c.diff
LOG: [Mips] clang-format prescanForConstants (NFC)
I'm planning to change the inner loop to a range-based for loop.
Added:
Modified:
llvm/lib/Target/Mips/MipsConstantIslandPass.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/Mips/MipsConstantIslandPass.cpp b/llvm/lib/Target/Mips/MipsConstantIslandPass.cpp
index 60bb10369df4fa..b2ba0f8fe74dc9 100644
--- a/llvm/lib/Target/Mips/MipsConstantIslandPass.cpp
+++ b/llvm/lib/Target/Mips/MipsConstantIslandPass.cpp
@@ -1635,30 +1635,29 @@ void MipsConstantIslands::prescanForConstants() {
EB = B.instr_end();
I != EB; ++I) {
switch(I->getDesc().getOpcode()) {
- case Mips::LwConstant32: {
- PrescannedForConstants = true;
+ case Mips::LwConstant32: {
+ PrescannedForConstants = true;
+ LLVM_DEBUG(dbgs() << "constant island constant " << *I << "\n");
+ LLVM_DEBUG(dbgs() << "num operands " << I->getNumOperands() << "\n");
+ MachineOperand &Literal = I->getOperand(1);
+ if (Literal.isImm()) {
+ int64_t V = Literal.getImm();
+ LLVM_DEBUG(dbgs() << "literal " << V << "\n");
+ Type *Int32Ty = Type::getInt32Ty(MF->getFunction().getContext());
+ const Constant *C = ConstantInt::get(Int32Ty, V);
+ unsigned index = MCP->getConstantPoolIndex(C, Align(4));
+ I->getOperand(2).ChangeToImmediate(index);
LLVM_DEBUG(dbgs() << "constant island constant " << *I << "\n");
- LLVM_DEBUG(dbgs() << "num operands " << I->getNumOperands() << "\n");
- MachineOperand& Literal = I->getOperand(1);
- if (Literal.isImm()) {
- int64_t V = Literal.getImm();
- LLVM_DEBUG(dbgs() << "literal " << V << "\n");
- Type *Int32Ty =
- Type::getInt32Ty(MF->getFunction().getContext());
- const Constant *C = ConstantInt::get(Int32Ty, V);
- unsigned index = MCP->getConstantPoolIndex(C, Align(4));
- I->getOperand(2).ChangeToImmediate(index);
- LLVM_DEBUG(dbgs() << "constant island constant " << *I << "\n");
- I->setDesc(TII->get(Mips::LwRxPcTcp16));
- I->removeOperand(1);
- I->removeOperand(1);
- I->addOperand(MachineOperand::CreateCPI(index, 0));
- I->addOperand(MachineOperand::CreateImm(4));
- }
- break;
+ I->setDesc(TII->get(Mips::LwRxPcTcp16));
+ I->removeOperand(1);
+ I->removeOperand(1);
+ I->addOperand(MachineOperand::CreateCPI(index, 0));
+ I->addOperand(MachineOperand::CreateImm(4));
}
- default:
- break;
+ break;
+ }
+ default:
+ break;
}
}
}
More information about the llvm-commits
mailing list