nllvmset.pas 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. {
  2. Copyright (c) 2019 by Jonas Maebe
  3. Generate LLVM bytecode for set/case nodes
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  15. ****************************************************************************
  16. }
  17. unit nllvmset;
  18. {$i fpcdefs.inc}
  19. interface
  20. uses
  21. nset, ncgset;
  22. type
  23. tllvmcasenode = class(tcgcasenode)
  24. protected
  25. procedure genlinearlist(hp: pcaselabel); override;
  26. end;
  27. implementation
  28. procedure tllvmcasenode.genlinearlist(hp: pcaselabel);
  29. begin
  30. { genlinearlist constantly updates the case value in the register,
  31. which causes tons of spilling with LLVM due to the need to bring
  32. it back into SSA form. LLVM will recognise and optimise the linear
  33. cmp list just as well (or even better), while the code that FPC
  34. has to generate is much smaller (no spilling) }
  35. genlinearcmplist(hp);
  36. end;
  37. begin
  38. ccasenode:=tllvmcasenode;
  39. end.