This is an archive of the discontinued LLVM Phabricator instance.

[Hexagon] Emit lookup tables in text section based on a flag
ClosedPublic

Authored by sgundapa on Jun 29 2017, 10:17 AM.

Details

Summary

The flag "-hexagon-emit-lut-text" (defaulted to false) is added to decide
on where to keep the switch generated lookup table.

Diff Detail

Event Timeline

sgundapa created this revision.Jun 29 2017, 10:17 AM
kparzysz added inline comments.Jun 29 2017, 12:37 PM
lib/Target/Hexagon/HexagonTargetObjectFile.cpp
142–145

This could be

if (const Function *Fn = getLutUsedFunction(GO))
  return selectSectionForLookupTable(G0, TM, Fn);
419

Maybe replace it with "if (!I) continue" to reduce indentation.

421

Are there legitimate cases where instruction does not have a parent? If not, you could remove this test (maybe add an assertion instead).

sgundapa added inline comments.Jun 30 2017, 9:49 AM
lib/Target/Hexagon/HexagonTargetObjectFile.cpp
419

I will work on indentation and push a new one

421

I am not sure about this which is why I am trying to be safe by returning a nullptr. There might be scenarios of dead basic blocks or functions . I probably need to run a big code base to see what might happen.

sgundapa updated this revision to Diff 104883.Jun 30 2017, 10:03 AM

Updated the patch with the indentation edit

sgundapa updated this revision to Diff 104915.Jun 30 2017, 1:03 PM
kparzysz accepted this revision.Jul 18 2017, 8:24 AM
This revision is now accepted and ready to land.Jul 18 2017, 8:24 AM
This revision was automatically updated to reflect the committed changes.