[tint] Move tint/lang/core/builtin to tint/lang/core
These are the fundamentals of the 'core' dialect.
Update namespaces from tint::builtin to tint::core.
Change-Id: I8c13a2b986f5c13646b2599969910b20fbe9bc8e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/144122
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
diff --git a/src/tint/lang/core/address_space.cc b/src/tint/lang/core/address_space.cc
new file mode 100644
index 0000000..4f4aaa1
--- /dev/null
+++ b/src/tint/lang/core/address_space.cc
@@ -0,0 +1,84 @@
+// Copyright 2020 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// src/tint/lang/core/address_space.cc.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+#include "src/tint/lang/core/address_space.h"
+
+namespace tint::core {
+
+/// ParseAddressSpace parses a AddressSpace from a string.
+/// @param str the string to parse
+/// @returns the parsed enum, or AddressSpace::kUndefined if the string could not be parsed.
+AddressSpace ParseAddressSpace(std::string_view str) {
+ if (str == "__in") {
+ return AddressSpace::kIn;
+ }
+ if (str == "__out") {
+ return AddressSpace::kOut;
+ }
+ if (str == "function") {
+ return AddressSpace::kFunction;
+ }
+ if (str == "private") {
+ return AddressSpace::kPrivate;
+ }
+ if (str == "push_constant") {
+ return AddressSpace::kPushConstant;
+ }
+ if (str == "storage") {
+ return AddressSpace::kStorage;
+ }
+ if (str == "uniform") {
+ return AddressSpace::kUniform;
+ }
+ if (str == "workgroup") {
+ return AddressSpace::kWorkgroup;
+ }
+ return AddressSpace::kUndefined;
+}
+
+std::string_view ToString(AddressSpace value) {
+ switch (value) {
+ case AddressSpace::kUndefined:
+ return "undefined";
+ case AddressSpace::kIn:
+ return "__in";
+ case AddressSpace::kOut:
+ return "__out";
+ case AddressSpace::kFunction:
+ return "function";
+ case AddressSpace::kHandle:
+ return "handle";
+ case AddressSpace::kPrivate:
+ return "private";
+ case AddressSpace::kPushConstant:
+ return "push_constant";
+ case AddressSpace::kStorage:
+ return "storage";
+ case AddressSpace::kUniform:
+ return "uniform";
+ case AddressSpace::kWorkgroup:
+ return "workgroup";
+ }
+ return "<unknown>";
+}
+
+} // namespace tint::core