swiftc -dump-ast main.swift
//输出
import Foundation
^
(source_file "main.swift"
(import_decl range=[main.swift:9:1 - line:9:8] 'Foundation')
(top_level_code_decl range=[main.swift:11:1 - line:11:22]
(brace_stmt range=[main.swift:11:1 - line:11:22]
(call_expr type='()' location=main.swift:11:1 range=[main.swift:11:1 - line:11:22] nothrow arg_labels=_:
(declref_expr type='(Any..., String, String) -> ()' location=main.swift:11:1 range=[main.swift:11:1 - line:11:1] decl=Swift.(file).print(_:separator:terminator:) function_ref=single)
(tuple_expr implicit type='(Any..., separator: String, terminator: String)' location=main.swift:11:6 range=[main.swift:11:6 - line:11:22] names='',separator,terminator
(vararg_expansion_expr implicit type='[Any]' location=main.swift:11:7 range=[main.swift:11:7 - line:11:7]
(array_expr implicit type='[Any]' location=main.swift:11:7 range=[main.swift:11:7 - line:11:7] initializer=**NULL**
(erasure_expr implicit type='Any' location=main.swift:11:7 range=[main.swift:11:7 - line:11:7]
(string_literal_expr type='String' location=main.swift:11:7 range=[main.swift:11:7 - line:11:7] encoding=utf8 value="Hello, World!" builtin_initializer=Swift.(file).String extension.init(_builtinStringLiteral:utf8CodeUnitCount:isASCII:) initializer=**NULL**))))
(default_argument_expr implicit type='String' location=main.swift:11:6 range=[main.swift:11:6 - line:11:6] default_args_owner=Swift.(file).print(_:separator:terminator:) param=1)
(default_argument_expr implicit type='String' location=main.swift:11:6 range=[main.swift:11:6 - line:11:6] default_args_owner=Swift.(file).print(_:separator:terminator:) param=2))))))
swiftc -emit-sil main.swift
swiftc -emit-ir main.swift -o main.ll
swiftc -emit-assembly main.swift -o main.s
网友评论