builtins.def 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. //
  5. // This is an X-macro header. It does not use `#include` guards, and instead is
  6. // designed to be `#include`ed after the x-macro is defined in order for its
  7. // inclusion to expand to the desired output. Macro definitions are cleaned up
  8. // at the end of this file.
  9. //
  10. // Supported x-macros are:
  11. // - CARBON_BUILTIN(Name)
  12. // Defines a builtin.
  13. #ifndef CARBON_BUILTIN
  14. #error "Must define the x-macro to use this file."
  15. #endif
  16. // Conversions.
  17. CARBON_BUILTIN(As)
  18. CARBON_BUILTIN(ImplicitAs)
  19. // Comparison.
  20. CARBON_BUILTIN(EqWith)
  21. CARBON_BUILTIN(LessWith)
  22. CARBON_BUILTIN(LessEqWith)
  23. CARBON_BUILTIN(GreaterWith)
  24. CARBON_BUILTIN(GreaterEqWith)
  25. CARBON_BUILTIN(CompareWith)
  26. // Arithmetic.
  27. CARBON_BUILTIN(Negate)
  28. CARBON_BUILTIN(AddWith)
  29. CARBON_BUILTIN(SubWith)
  30. CARBON_BUILTIN(MulWith)
  31. CARBON_BUILTIN(DivWith)
  32. CARBON_BUILTIN(ModWith)
  33. // Bitwise and shift.
  34. CARBON_BUILTIN(BitComplement)
  35. CARBON_BUILTIN(BitAndWith)
  36. CARBON_BUILTIN(BitOrWith)
  37. CARBON_BUILTIN(BitXorWith)
  38. CARBON_BUILTIN(LeftShiftWith)
  39. CARBON_BUILTIN(RightShiftWith)
  40. // Simple assignment.
  41. CARBON_BUILTIN(AssignWith)
  42. // Compound assignment.
  43. CARBON_BUILTIN(AddAssignWith)
  44. CARBON_BUILTIN(SubAssignWith)
  45. CARBON_BUILTIN(MulAssignWith)
  46. CARBON_BUILTIN(DivAssignWith)
  47. CARBON_BUILTIN(ModAssignWith)
  48. CARBON_BUILTIN(BitAndAssignWith)
  49. CARBON_BUILTIN(BitOrAssignWith)
  50. CARBON_BUILTIN(BitXorAssignWith)
  51. CARBON_BUILTIN(LeftShiftAssignWith)
  52. CARBON_BUILTIN(RightShiftAssignWith)
  53. // Increment and decrement.
  54. CARBON_BUILTIN(Inc)
  55. CARBON_BUILTIN(Dec)
  56. // Last for the number of builtins.
  57. CARBON_BUILTIN(Invalid)
  58. #undef CARBON_BUILTIN