Files
carbon-lang/toolchain/sem_ir/builtin_function_kind.def
T
Jon Ross-Perkins 8bb80d8271 Add a basic Core.Print function for ints. (#4078)
We'd been discussing that explorer remains necessary for print, and I
was wondering if this kind of approach would be okay (we _probably_ want
this to work, based on #2110, albeit with more overloads -- but I don't
think there's a good way to support overloads at the moment).

```
╚╡../bazel-bin/examples/sieve
2
3
5
7
11
13
17
19
23
29
31
37
41
43
...
```
2024-06-25 21:32:07 +00:00

75 lines
2.8 KiB
Modula-2

// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
// This is an X-macro header. It does not use `#include` guards, and instead is
// designed to be `#include`ed after the x-macro is defined in order for its
// inclusion to expand to the desired output. Macro definitions are cleaned up
// at the end of this file.
//
// Supported x-macro is:
// - CARBON_SEM_IR_BUILTIN_FUNCTION_KIND(Name)
// Defines a builtin function type.
#if !defined(CARBON_SEM_IR_BUILTIN_FUNCTION_KIND)
#error \
"Must define CARBON_SEM_IR_BUILTIN_FUNCTION_KIND x-macro to use this file."
#endif
CARBON_SEM_IR_BUILTIN_FUNCTION_KIND(None)
CARBON_SEM_IR_BUILTIN_FUNCTION_KIND(PrintInt)
// Type factories.
CARBON_SEM_IR_BUILTIN_FUNCTION_KIND(IntMakeType32)
CARBON_SEM_IR_BUILTIN_FUNCTION_KIND(IntMakeTypeSigned)
CARBON_SEM_IR_BUILTIN_FUNCTION_KIND(IntMakeTypeUnsigned)
CARBON_SEM_IR_BUILTIN_FUNCTION_KIND(FloatMakeType)
CARBON_SEM_IR_BUILTIN_FUNCTION_KIND(BoolMakeType)
// Integer arithmetic.
CARBON_SEM_IR_BUILTIN_FUNCTION_KIND(IntSNegate)
CARBON_SEM_IR_BUILTIN_FUNCTION_KIND(IntSAdd)
CARBON_SEM_IR_BUILTIN_FUNCTION_KIND(IntSSub)
CARBON_SEM_IR_BUILTIN_FUNCTION_KIND(IntSMul)
CARBON_SEM_IR_BUILTIN_FUNCTION_KIND(IntSDiv)
CARBON_SEM_IR_BUILTIN_FUNCTION_KIND(IntSMod)
CARBON_SEM_IR_BUILTIN_FUNCTION_KIND(IntUNegate)
CARBON_SEM_IR_BUILTIN_FUNCTION_KIND(IntUAdd)
CARBON_SEM_IR_BUILTIN_FUNCTION_KIND(IntUSub)
CARBON_SEM_IR_BUILTIN_FUNCTION_KIND(IntUMul)
CARBON_SEM_IR_BUILTIN_FUNCTION_KIND(IntUDiv)
CARBON_SEM_IR_BUILTIN_FUNCTION_KIND(IntUMod)
// Integer bitwise.
CARBON_SEM_IR_BUILTIN_FUNCTION_KIND(IntComplement)
CARBON_SEM_IR_BUILTIN_FUNCTION_KIND(IntAnd)
CARBON_SEM_IR_BUILTIN_FUNCTION_KIND(IntOr)
CARBON_SEM_IR_BUILTIN_FUNCTION_KIND(IntXor)
CARBON_SEM_IR_BUILTIN_FUNCTION_KIND(IntLeftShift)
CARBON_SEM_IR_BUILTIN_FUNCTION_KIND(IntRightShift)
// Integer comparison.
CARBON_SEM_IR_BUILTIN_FUNCTION_KIND(IntEq)
CARBON_SEM_IR_BUILTIN_FUNCTION_KIND(IntNeq)
CARBON_SEM_IR_BUILTIN_FUNCTION_KIND(IntLess)
CARBON_SEM_IR_BUILTIN_FUNCTION_KIND(IntLessEq)
CARBON_SEM_IR_BUILTIN_FUNCTION_KIND(IntGreater)
CARBON_SEM_IR_BUILTIN_FUNCTION_KIND(IntGreaterEq)
// Float arithmetic.
CARBON_SEM_IR_BUILTIN_FUNCTION_KIND(FloatNegate)
CARBON_SEM_IR_BUILTIN_FUNCTION_KIND(FloatAdd)
CARBON_SEM_IR_BUILTIN_FUNCTION_KIND(FloatSub)
CARBON_SEM_IR_BUILTIN_FUNCTION_KIND(FloatMul)
CARBON_SEM_IR_BUILTIN_FUNCTION_KIND(FloatDiv)
// Float comparison.
CARBON_SEM_IR_BUILTIN_FUNCTION_KIND(FloatEq)
CARBON_SEM_IR_BUILTIN_FUNCTION_KIND(FloatNeq)
CARBON_SEM_IR_BUILTIN_FUNCTION_KIND(FloatLess)
CARBON_SEM_IR_BUILTIN_FUNCTION_KIND(FloatLessEq)
CARBON_SEM_IR_BUILTIN_FUNCTION_KIND(FloatGreater)
CARBON_SEM_IR_BUILTIN_FUNCTION_KIND(FloatGreaterEq)
#undef CARBON_SEM_IR_BUILTIN_FUNCTION_KIND