2
0

TargetOptionsImpl.cpp 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. //===-- TargetOptionsImpl.cpp - Options that apply to all targets ----------==//
  2. //
  3. // The LLVM Compiler Infrastructure
  4. //
  5. // This file is distributed under the University of Illinois Open Source
  6. // License. See LICENSE.TXT for details.
  7. //
  8. //===----------------------------------------------------------------------===//
  9. //
  10. // This file implements the methods in the TargetOptions.
  11. //
  12. //===----------------------------------------------------------------------===//
  13. #include "llvm/IR/Function.h"
  14. #include "llvm/IR/Module.h"
  15. #include "llvm/CodeGen/MachineFrameInfo.h"
  16. #include "llvm/CodeGen/MachineFunction.h"
  17. #include "llvm/Target/TargetFrameLowering.h"
  18. #include "llvm/Target/TargetOptions.h"
  19. #include "llvm/Target/TargetSubtargetInfo.h"
  20. using namespace llvm;
  21. /// DisableFramePointerElim - This returns true if frame pointer elimination
  22. /// optimization should be disabled for the given machine function.
  23. bool TargetOptions::DisableFramePointerElim(const MachineFunction &MF) const {
  24. // Check to see if we should eliminate all frame pointers.
  25. if (MF.getSubtarget().getFrameLowering()->noFramePointerElim(MF))
  26. return true;
  27. // Check to see if we should eliminate non-leaf frame pointers.
  28. if (MF.getFunction()->hasFnAttribute("no-frame-pointer-elim-non-leaf"))
  29. return MF.getFrameInfo()->hasCalls();
  30. return false;
  31. }
  32. /// LessPreciseFPMAD - This flag return true when -enable-fp-mad option
  33. /// is specified on the command line. When this flag is off(default), the
  34. /// code generator is not allowed to generate mad (multiply add) if the
  35. /// result is "less precise" than doing those operations individually.
  36. bool TargetOptions::LessPreciseFPMAD() const {
  37. return UnsafeFPMath || LessPreciseFPMADOption;
  38. }
  39. /// HonorSignDependentRoundingFPMath - Return true if the codegen must assume
  40. /// that the rounding mode of the FPU can change from its default.
  41. bool TargetOptions::HonorSignDependentRoundingFPMath() const {
  42. return !UnsafeFPMath && HonorSignDependentRoundingFPMathOption;
  43. }