mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-15 15:58:10 +00:00
I'm trying to increase the distinction between BuiltinKind and
BuiltinFunctionKind. BuiltinKind is for instructions,
BuiltinFunctionKind is for function definitions. To get to this point,
I'm doing a few changes:
- BuiltinKind -> BuiltinInstKind
- builtin_kind.* -> builtin_inst_kind.*: filename consistency
- Builtin -> BuiltinInst: mainly for consistency with the above
- Builtin::builtin_kind -> BuiltinInst::builtin_inst_kind: somewhat
repetitive but seems like a consistent edit
- Function::builtin_kind -> Function::builtin_function_kind: seems a
useful distinction
I'm leaving alone things like (and mentioning in case there's a desire
for more renames):
- InstId::BuiltinError, InstId::ForBuiltin: these I think are more
apparent because they're directly associated with Inst.
- GetBuiltinICmpPredicate in lowering: maybe builtin function handling
should be in its own file, but these local names don't feel problematic
to me.
- GetBuiltinType, BuildBuiltinValueRepr, PerformBuiltinIntComparison:
similar to the above, names don't feel too problematic
24 lines
743 B
C++
24 lines
743 B
C++
// 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
|
|
|
|
#include "toolchain/sem_ir/builtin_inst_kind.h"
|
|
|
|
namespace Carbon::SemIR {
|
|
|
|
CARBON_DEFINE_ENUM_CLASS_NAMES(BuiltinInstKind) = {
|
|
#define CARBON_SEM_IR_BUILTIN_INST_KIND_NAME(Name) \
|
|
CARBON_ENUM_CLASS_NAME_STRING(Name)
|
|
#include "toolchain/sem_ir/builtin_inst_kind.def"
|
|
};
|
|
|
|
auto BuiltinInstKind::label() -> llvm::StringRef {
|
|
static constexpr llvm::StringLiteral Labels[] = {
|
|
#define CARBON_SEM_IR_BUILTIN_INST_KIND(Name, Label) Label,
|
|
#include "toolchain/sem_ir/builtin_inst_kind.def"
|
|
};
|
|
return Labels[AsInt()];
|
|
}
|
|
|
|
} // namespace Carbon::SemIR
|