[PATCH] D23456: [Sparc] Leon Errata Fix Passes
Daniel Cederman via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 6 06:50:08 PDT 2016
dcederman added a comment.
If you want to speed up the reviewing process you should split up the patches. For example, setMaxAtomicSizeInBitsSupported and useSoftFpu should not be included here.
The removal of the inline asm part could be its own, easy to accept, patch.
And, as I asked before, have you made sure that your code is actually tested by your tests? The unit tests that you have included does not seem to be related to the new passes.
================
Comment at: lib/Target/Sparc/LeonPasses.cpp:63-85
@@ -61,2 +62,25 @@
+// finds a new free integer register
+// checks also the AllocatedRegisters vector
+int LEONMachineFunctionPass::getUnusedIntRegister(MachineRegisterInfo &MRI) {
+ // checks the local registers first
+ for (int RegisterIndex = SP::L0; RegisterIndex <= SP::L7; ++RegisterIndex) {
+ if (!MRI.isPhysRegUsed(RegisterIndex) &&
+ !is_contained(UsedRegisters, RegisterIndex)) {
+ return RegisterIndex;
+ }
+ }
+
+ // then checks the global registers, but G0
+ for (int RegisterIndex = SP::G1; RegisterIndex <= SP::G7; ++RegisterIndex) {
+ if (!MRI.isPhysRegUsed(RegisterIndex) &&
+ !is_contained(UsedRegisters, RegisterIndex)) {
+ return RegisterIndex;
+ }
+ }
+
+ return -1;
+}
+
+
//*****************************************************************************
----------------
This does not seem to be the right way to get a free register if it means that you could get G7 back as a work register. That register and others are reserved for the OS and could mess things up if changed.
And what do you do if no register is available?
================
Comment at: lib/Target/Sparc/LeonPasses.cpp:506
@@ +505,3 @@
+
+ const int ScratchReg1Index = getUnusedIntRegister(MF.getRegInfo());
+ markRegisterUsed(ScratchReg1Index);
----------------
Here you need to handle the case when getUnusedIntRegister returns -1
Repository:
rL LLVM
https://reviews.llvm.org/D23456
More information about the llvm-commits
mailing list