Rename 'intrinsic' to 'builtin'
This matches the term used in the WGSL spec.
Change-Id: I4603332b828450c126ef806f1064ed54f372013f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/78787
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
diff --git a/tools/src/cmd/intrinsic-gen/ast/ast.go b/tools/src/cmd/builtin-gen/ast/ast.go
similarity index 98%
rename from tools/src/cmd/intrinsic-gen/ast/ast.go
rename to tools/src/cmd/builtin-gen/ast/ast.go
index 8d1da0e..e67530b 100644
--- a/tools/src/cmd/intrinsic-gen/ast/ast.go
+++ b/tools/src/cmd/builtin-gen/ast/ast.go
@@ -20,7 +20,7 @@
"fmt"
"strings"
- "dawn.googlesource.com/tint/tools/src/cmd/intrinsic-gen/tok"
+ "dawn.googlesource.com/tint/tools/src/cmd/builtin-gen/tok"
)
// AST is the parsed syntax tree of the intrinsic definition file
diff --git a/tools/src/cmd/intrinsic-gen/gen/intrinsic_table.go b/tools/src/cmd/builtin-gen/gen/builtin_table.go
similarity index 87%
rename from tools/src/cmd/intrinsic-gen/gen/intrinsic_table.go
rename to tools/src/cmd/builtin-gen/gen/builtin_table.go
index 821b1d6..dcd7a5f 100644
--- a/tools/src/cmd/intrinsic-gen/gen/intrinsic_table.go
+++ b/tools/src/cmd/builtin-gen/gen/builtin_table.go
@@ -17,13 +17,13 @@
import (
"fmt"
- "dawn.googlesource.com/tint/tools/src/cmd/intrinsic-gen/sem"
+ "dawn.googlesource.com/tint/tools/src/cmd/builtin-gen/sem"
"dawn.googlesource.com/tint/tools/src/list"
"dawn.googlesource.com/tint/tools/src/lut"
)
-// IntrinsicTable holds data specific to the intrinsic_table.inl.tmpl template
-type IntrinsicTable struct {
+// BuiltinTable holds data specific to the intrinsic_table.inl.tmpl template
+type BuiltinTable struct {
// The semantic info
Sem *sem.Sem
@@ -42,7 +42,7 @@
OpenNumbers []OpenNumber // kOpenNumbers table content
Parameters []Parameter // kParameters table content
Overloads []Overload // kOverloads table content
- Functions []Function // kIntrinsics table content
+ Functions []Function // kBuiltins table content
}
// OpenType is used to create the C++ OpenTypeInfo structure
@@ -68,9 +68,9 @@
// The parameter usage (parameter name)
Usage string
- // Index into IntrinsicTable.MatcherIndices, beginning the list of matchers
+ // Index into BuiltinTable.MatcherIndices, beginning the list of matchers
// required to match the parameter type. The matcher indices index
- // into IntrinsicTable::TMatchers and / or IntrinsicTable::NMatchers.
+ // into BuiltinTable::TMatchers and / or BuiltinTable::NMatchers.
// These indices are consumed by the matchers themselves.
// The first index is always a TypeMatcher.
MatcherIndicesOffset *int
@@ -84,15 +84,15 @@
NumOpenTypes int
// Total number of open numbers for the overload
NumOpenNumbers int
- // Index to the first open type in IntrinsicTable.OpenTypes
+ // Index to the first open type in BuiltinTable.OpenTypes
OpenTypesOffset *int
- // Index to the first open number in IntrinsicTable.OpenNumbers
+ // Index to the first open number in BuiltinTable.OpenNumbers
OpenNumbersOffset *int
- // Index to the first parameter in IntrinsicTable.Parameters
+ // Index to the first parameter in BuiltinTable.Parameters
ParametersOffset *int
- // Index into IntrinsicTable.MatcherIndices, beginning the list of matchers
+ // Index into BuiltinTable.MatcherIndices, beginning the list of matchers
// required to match the return type. The matcher indices index
- // into IntrinsicTable::TMatchers and / or IntrinsicTable::NMatchers.
+ // into BuiltinTable::TMatchers and / or BuiltinTable::NMatchers.
// These indices are consumed by the matchers themselves.
// The first index is always a TypeMatcher.
ReturnMatcherIndicesOffset *int
@@ -109,10 +109,10 @@
OverloadsOffset *int
}
-// Helper for building the IntrinsicTable
-type intrinsicTableBuilder struct {
+// Helper for building the BuiltinTable
+type BuiltinTableBuilder struct {
// The output of the builder
- IntrinsicTable
+ BuiltinTable
// Lookup tables.
// These are packed (compressed) once all the entries have been added.
@@ -127,7 +127,7 @@
// Helper for building a single overload
type overloadBuilder struct {
- *intrinsicTableBuilder
+ *BuiltinTableBuilder
// Maps TemplateParam to index in openTypes
openTypeIndex map[sem.TemplateParam]int
// Maps TemplateParam to index in openNumbers
@@ -138,9 +138,9 @@
openNumbers []OpenNumber
// All parameters declared by the overload
parameters []Parameter
- // Index into IntrinsicTable.MatcherIndices, beginning the list of matchers
+ // Index into BuiltinTable.MatcherIndices, beginning the list of matchers
// required to match the return type. The matcher indices index
- // into IntrinsicTable::TMatchers and / or IntrinsicTable::NMatchers.
+ // into BuiltinTable::TMatchers and / or BuiltinTable::NMatchers.
// These indices are consumed by the matchers themselves.
// The first index is always a TypeMatcher.
returnTypeMatcherIndicesOffset *int
@@ -148,7 +148,7 @@
// layoutMatchers assigns each of the TMatchers and NMatchers a unique index
// in the C++ Matchers::type and Matchers::number arrays, respectively.
-func (b *intrinsicTableBuilder) layoutMatchers(s *sem.Sem) {
+func (b *BuiltinTableBuilder) layoutMatchers(s *sem.Sem) {
// First MaxOpenTypes of TMatchers are open types
b.TMatchers = make([]sem.Named, s.MaxOpenTypes)
for _, m := range s.Types {
@@ -169,11 +169,11 @@
}
// buildOverload constructs an Overload for a sem.Overload
-func (b *intrinsicTableBuilder) buildOverload(o *sem.Overload) (Overload, error) {
+func (b *BuiltinTableBuilder) buildOverload(o *sem.Overload) (Overload, error) {
ob := overloadBuilder{
- intrinsicTableBuilder: b,
- openTypeIndex: map[sem.TemplateParam]int{},
- openNumberIndex: map[sem.TemplateParam]int{},
+ BuiltinTableBuilder: b,
+ openTypeIndex: map[sem.TemplateParam]int{},
+ openNumberIndex: map[sem.TemplateParam]int{},
}
if err := ob.buildOpenTypes(o); err != nil {
@@ -279,7 +279,7 @@
}
// matcherIndex returns the index of TMatcher or NMatcher in
-// IntrinsicTable.TMatcher or IntrinsicTable.NMatcher, respectively.
+// BuiltinTable.TMatcher or BuiltinTable.NMatcher, respectively.
func (b *overloadBuilder) matcherIndex(n sem.Named) (int, error) {
switch n := n.(type) {
case *sem.Type, *sem.TypeMatcher:
@@ -342,10 +342,10 @@
return out, nil
}
-// buildIntrinsicTable builds the IntrinsicTable from the semantic info
-func buildIntrinsicTable(s *sem.Sem) (*IntrinsicTable, error) {
- b := intrinsicTableBuilder{
- IntrinsicTable: IntrinsicTable{
+// buildBuiltinTable builds the BuiltinTable from the semantic info
+func buildBuiltinTable(s *sem.Sem) (*BuiltinTable, error) {
+ b := BuiltinTableBuilder{
+ BuiltinTable: BuiltinTable{
Sem: s,
TMatcherIndex: map[sem.Named]int{},
NMatcherIndex: map[sem.Named]int{},
@@ -383,5 +383,5 @@
b.lut.parameters.Compact()
b.lut.overloads.Compact()
- return &b.IntrinsicTable, nil
+ return &b.BuiltinTable, nil
}
diff --git a/tools/src/cmd/intrinsic-gen/gen/generate.go b/tools/src/cmd/builtin-gen/gen/generate.go
similarity index 93%
rename from tools/src/cmd/intrinsic-gen/gen/generate.go
rename to tools/src/cmd/builtin-gen/gen/generate.go
index 34a8257..ad9fd7e 100644
--- a/tools/src/cmd/intrinsic-gen/gen/generate.go
+++ b/tools/src/cmd/builtin-gen/gen/generate.go
@@ -22,15 +22,15 @@
"text/template"
"unicode"
- "dawn.googlesource.com/tint/tools/src/cmd/intrinsic-gen/sem"
+ "dawn.googlesource.com/tint/tools/src/cmd/builtin-gen/sem"
)
type generator struct {
s *sem.Sem
t *template.Template
cached struct {
- intrinsicTable *IntrinsicTable // lazily built by intrinsicTable()
- permuter *Permuter // lazily built by permute()
+ builtinTable *BuiltinTable // lazily built by builtinTable()
+ permuter *Permuter // lazily built by permute()
}
}
@@ -73,7 +73,7 @@
"IsDeclarable": isDeclarable,
"IsFirstIn": isFirstIn,
"IsLastIn": isLastIn,
- "IntrinsicTable": g.intrinsicTable,
+ "BuiltinTable": g.builtinTable,
"Permute": g.permute,
"Eval": g.eval,
"WriteFile": func(relpath, content string) (string, error) { return "", writeFile(relpath, content) },
@@ -121,17 +121,17 @@
return sb.String(), nil
}
-// intrinsicTable lazily calls and returns the result of buildIntrinsicTable(),
+// builtinTable lazily calls and returns the result of buildBuiltinTable(),
// caching the result for repeated calls.
-func (g *generator) intrinsicTable() (*IntrinsicTable, error) {
- if g.cached.intrinsicTable == nil {
+func (g *generator) builtinTable() (*BuiltinTable, error) {
+ if g.cached.builtinTable == nil {
var err error
- g.cached.intrinsicTable, err = buildIntrinsicTable(g.s)
+ g.cached.builtinTable, err = buildBuiltinTable(g.s)
if err != nil {
return nil, err
}
}
- return g.cached.intrinsicTable, nil
+ return g.cached.builtinTable, nil
}
// permute lazily calls buildPermuter(), caching the result for repeated
diff --git a/tools/src/cmd/intrinsic-gen/gen/permutate.go b/tools/src/cmd/builtin-gen/gen/permutate.go
similarity index 99%
rename from tools/src/cmd/intrinsic-gen/gen/permutate.go
rename to tools/src/cmd/builtin-gen/gen/permutate.go
index 61fda1a..814fcbc 100644
--- a/tools/src/cmd/intrinsic-gen/gen/permutate.go
+++ b/tools/src/cmd/builtin-gen/gen/permutate.go
@@ -20,7 +20,7 @@
"fmt"
"strings"
- "dawn.googlesource.com/tint/tools/src/cmd/intrinsic-gen/sem"
+ "dawn.googlesource.com/tint/tools/src/cmd/builtin-gen/sem"
"dawn.googlesource.com/tint/tools/src/fileutils"
)
diff --git a/tools/src/cmd/intrinsic-gen/lexer/lexer.go b/tools/src/cmd/builtin-gen/lexer/lexer.go
similarity index 98%
rename from tools/src/cmd/intrinsic-gen/lexer/lexer.go
rename to tools/src/cmd/builtin-gen/lexer/lexer.go
index 1f25aea..fa50b22 100644
--- a/tools/src/cmd/intrinsic-gen/lexer/lexer.go
+++ b/tools/src/cmd/builtin-gen/lexer/lexer.go
@@ -20,7 +20,7 @@
"fmt"
"unicode"
- "dawn.googlesource.com/tint/tools/src/cmd/intrinsic-gen/tok"
+ "dawn.googlesource.com/tint/tools/src/cmd/builtin-gen/tok"
)
// Lex produces a list of tokens for the given source code
diff --git a/tools/src/cmd/intrinsic-gen/lexer/lexer_test.go b/tools/src/cmd/builtin-gen/lexer/lexer_test.go
similarity index 97%
rename from tools/src/cmd/intrinsic-gen/lexer/lexer_test.go
rename to tools/src/cmd/builtin-gen/lexer/lexer_test.go
index d0ec922..940163d 100644
--- a/tools/src/cmd/intrinsic-gen/lexer/lexer_test.go
+++ b/tools/src/cmd/builtin-gen/lexer/lexer_test.go
@@ -18,8 +18,8 @@
"fmt"
"testing"
- "dawn.googlesource.com/tint/tools/src/cmd/intrinsic-gen/lexer"
- "dawn.googlesource.com/tint/tools/src/cmd/intrinsic-gen/tok"
+ "dawn.googlesource.com/tint/tools/src/cmd/builtin-gen/lexer"
+ "dawn.googlesource.com/tint/tools/src/cmd/builtin-gen/tok"
)
func TestLexTokens(t *testing.T) {
diff --git a/tools/src/cmd/intrinsic-gen/main.go b/tools/src/cmd/builtin-gen/main.go
similarity index 88%
rename from tools/src/cmd/intrinsic-gen/main.go
rename to tools/src/cmd/builtin-gen/main.go
index 0a55fdd..d126cf9 100644
--- a/tools/src/cmd/intrinsic-gen/main.go
+++ b/tools/src/cmd/builtin-gen/main.go
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-// intrinsic-gen parses the <tint>/src/intrinsics.def file, then scans the
+// builtin-gen parses the <tint>/src/builtins.def file, then scans the
// project directory for '<file>.tmpl' files, to produce '<file>' source code
// files.
package main
@@ -25,14 +25,14 @@
"path/filepath"
"strings"
- "dawn.googlesource.com/tint/tools/src/cmd/intrinsic-gen/gen"
- "dawn.googlesource.com/tint/tools/src/cmd/intrinsic-gen/parser"
- "dawn.googlesource.com/tint/tools/src/cmd/intrinsic-gen/resolver"
+ "dawn.googlesource.com/tint/tools/src/cmd/builtin-gen/gen"
+ "dawn.googlesource.com/tint/tools/src/cmd/builtin-gen/parser"
+ "dawn.googlesource.com/tint/tools/src/cmd/builtin-gen/resolver"
"dawn.googlesource.com/tint/tools/src/fileutils"
"dawn.googlesource.com/tint/tools/src/glob"
)
-const defProjectRelPath = "src/intrinsics.def"
+const defProjectRelPath = "src/builtins.def"
func main() {
if err := run(); err != nil {
@@ -43,13 +43,13 @@
func showUsage() {
fmt.Println(`
-intrinsic-gen generates the intrinsic table for the Tint compiler
+builtin-gen generates the builtin table for the Tint compiler
-intrinsic-gen parses the <tint>/src/intrinsics.def file, then scans the project
+builtin-gen parses the <tint>/src/builtins.def file, then scans the project
directory for '<file>.tmpl' files, to produce '<file>' source code files.
usage:
- intrinsic-gen
+ builtin-gen
optional flags:`)
flag.PrintDefaults()
@@ -58,7 +58,7 @@
}
func run() error {
- // Load the intrinsics definition file
+ // Load the builtins definition file
projectRoot := fileutils.ProjectRoot()
defPath := filepath.Join(projectRoot, defProjectRelPath)
@@ -161,10 +161,10 @@
// limitations under the License.
////////////////////////////////////////////////////////////////////////////////
-// File generated by tools/intrinsic-gen
+// File generated by tools/builtin-gen
// using the template:
// %v
-// and the intrinsic defintion file:
+// and the builtin defintion file:
// %v
//
// Do not modify this file directly
diff --git a/tools/src/cmd/intrinsic-gen/parser/parser.go b/tools/src/cmd/builtin-gen/parser/parser.go
similarity index 96%
rename from tools/src/cmd/intrinsic-gen/parser/parser.go
rename to tools/src/cmd/builtin-gen/parser/parser.go
index 4ab3516..4709bca 100644
--- a/tools/src/cmd/intrinsic-gen/parser/parser.go
+++ b/tools/src/cmd/builtin-gen/parser/parser.go
@@ -12,16 +12,16 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-// Package parser provides a basic parser for the Tint intrinsic definition
+// Package parser provides a basic parser for the Tint builtin definition
// language
package parser
import (
"fmt"
- "dawn.googlesource.com/tint/tools/src/cmd/intrinsic-gen/ast"
- "dawn.googlesource.com/tint/tools/src/cmd/intrinsic-gen/lexer"
- "dawn.googlesource.com/tint/tools/src/cmd/intrinsic-gen/tok"
+ "dawn.googlesource.com/tint/tools/src/cmd/builtin-gen/ast"
+ "dawn.googlesource.com/tint/tools/src/cmd/builtin-gen/lexer"
+ "dawn.googlesource.com/tint/tools/src/cmd/builtin-gen/tok"
)
// Parse produces a list of tokens for the given source code
diff --git a/tools/src/cmd/intrinsic-gen/parser/parser_test.go b/tools/src/cmd/builtin-gen/parser/parser_test.go
similarity index 97%
rename from tools/src/cmd/intrinsic-gen/parser/parser_test.go
rename to tools/src/cmd/builtin-gen/parser/parser_test.go
index fdc884b..3d229c0 100644
--- a/tools/src/cmd/intrinsic-gen/parser/parser_test.go
+++ b/tools/src/cmd/builtin-gen/parser/parser_test.go
@@ -17,8 +17,8 @@
import (
"testing"
- "dawn.googlesource.com/tint/tools/src/cmd/intrinsic-gen/ast"
- "dawn.googlesource.com/tint/tools/src/cmd/intrinsic-gen/parser"
+ "dawn.googlesource.com/tint/tools/src/cmd/builtin-gen/ast"
+ "dawn.googlesource.com/tint/tools/src/cmd/builtin-gen/parser"
)
func TestParser(t *testing.T) {
diff --git a/tools/src/cmd/intrinsic-gen/resolver/resolve.go b/tools/src/cmd/builtin-gen/resolver/resolve.go
similarity index 98%
rename from tools/src/cmd/intrinsic-gen/resolver/resolve.go
rename to tools/src/cmd/builtin-gen/resolver/resolve.go
index 951df74..fbd9c9d 100644
--- a/tools/src/cmd/intrinsic-gen/resolver/resolve.go
+++ b/tools/src/cmd/builtin-gen/resolver/resolve.go
@@ -18,9 +18,9 @@
"fmt"
"sort"
- "dawn.googlesource.com/tint/tools/src/cmd/intrinsic-gen/ast"
- "dawn.googlesource.com/tint/tools/src/cmd/intrinsic-gen/sem"
- "dawn.googlesource.com/tint/tools/src/cmd/intrinsic-gen/tok"
+ "dawn.googlesource.com/tint/tools/src/cmd/builtin-gen/ast"
+ "dawn.googlesource.com/tint/tools/src/cmd/builtin-gen/sem"
+ "dawn.googlesource.com/tint/tools/src/cmd/builtin-gen/tok"
)
type resolver struct {
diff --git a/tools/src/cmd/intrinsic-gen/resolver/resolver_test.go b/tools/src/cmd/builtin-gen/resolver/resolver_test.go
similarity index 97%
rename from tools/src/cmd/intrinsic-gen/resolver/resolver_test.go
rename to tools/src/cmd/builtin-gen/resolver/resolver_test.go
index 944ddb4..11359dd 100644
--- a/tools/src/cmd/intrinsic-gen/resolver/resolver_test.go
+++ b/tools/src/cmd/builtin-gen/resolver/resolver_test.go
@@ -19,8 +19,8 @@
"strings"
"testing"
- "dawn.googlesource.com/tint/tools/src/cmd/intrinsic-gen/parser"
- "dawn.googlesource.com/tint/tools/src/cmd/intrinsic-gen/resolver"
+ "dawn.googlesource.com/tint/tools/src/cmd/builtin-gen/parser"
+ "dawn.googlesource.com/tint/tools/src/cmd/builtin-gen/resolver"
)
func TestResolver(t *testing.T) {
diff --git a/tools/src/cmd/intrinsic-gen/sem/sem.go b/tools/src/cmd/builtin-gen/sem/sem.go
similarity index 96%
rename from tools/src/cmd/intrinsic-gen/sem/sem.go
rename to tools/src/cmd/builtin-gen/sem/sem.go
index b1dc485..16a8c3e 100644
--- a/tools/src/cmd/intrinsic-gen/sem/sem.go
+++ b/tools/src/cmd/builtin-gen/sem/sem.go
@@ -17,7 +17,7 @@
import (
"fmt"
- "dawn.googlesource.com/tint/tools/src/cmd/intrinsic-gen/ast"
+ "dawn.googlesource.com/tint/tools/src/cmd/builtin-gen/ast"
)
// Sem is the root of the semantic tree
@@ -27,9 +27,9 @@
TypeMatchers []*TypeMatcher
EnumMatchers []*EnumMatcher
Functions []*Function
- // Maximum number of open-types used across all intrinsics
+ // Maximum number of open-types used across all builtins
MaxOpenTypes int
- // Maximum number of open-numbers used across all intrinsics
+ // Maximum number of open-numbers used across all builtins
MaxOpenNumbers int
// The alphabetically sorted list of unique parameter names
UniqueParameterNames []string
@@ -121,7 +121,7 @@
Name string
}
-// Function describes the overloads of an intrinsic function
+// Function describes the overloads of a builtin function
type Function struct {
Name string
Overloads []*Overload
diff --git a/tools/src/cmd/intrinsic-gen/tok/tok.go b/tools/src/cmd/builtin-gen/tok/tok.go
similarity index 100%
rename from tools/src/cmd/intrinsic-gen/tok/tok.go
rename to tools/src/cmd/builtin-gen/tok/tok.go