Skip to content

Commit

Permalink
LLVM 后端缺少维护先删除, 后期如果需求再恢复
Browse files Browse the repository at this point in the history
  • Loading branch information
chai2010 committed Nov 10, 2023
1 parent 2d004b5 commit d8636d1
Show file tree
Hide file tree
Showing 45 changed files with 32 additions and 2,340 deletions.
1 change: 0 additions & 1 deletion api/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ const (
WaBackend_Default = config.WaBackend_Default // 默认

WaBackend_clang = config.WaBackend_clang // 输出 c
WaBackend_llvm = config.WaBackend_llvm // 输出 llir
WaBackend_wat = config.WaBackend_wat // 输出 wat
)

Expand Down
5 changes: 1 addition & 4 deletions docs/goals.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,16 @@ graph LR
wa_ast(Wa AST);
c_cpp(C/C++);
llir(LLVM IR);
wasm(WASM);
wa_ext --> wa_ast;
wago_ext --> wa_ast;
wa_ast --> c_cpp;
wa_ast --> llir;
wa_ast --> wasm;
```

凹编译器支持 C/C++、LLVM IR、WASM 等多种输出以满足不同的目标场景。当前阶段的主要任务:
凹编译器支持 C/C++、WASM 等多种输出以满足不同的目标场景。当前阶段的主要任务:
- 创建编译器框架
- 确定前中后端模块间的接口
- 设计能满足语法特性基线的运行时模型
Expand All @@ -72,7 +70,6 @@ graph LR
各后端可能的应用场景:

- C/C++:凹语言™与 C/C++ 混合开发
- LLVM IR:直接编译为Native Code
- WASM:直接编译为WebAssembly模块

当任一后端模块覆盖“可用最小集”,我们将尝试开发一些简单的网页示例,待选的方向有交互式图形图像、在线编译等。
Expand Down
178 changes: 0 additions & 178 deletions internal/app/appllvm/appllvm.go

This file was deleted.

2 changes: 0 additions & 2 deletions internal/app/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"wa-lang.org/wa/internal/app/appfmt"
"wa-lang.org/wa/internal/app/appinit"
"wa-lang.org/wa/internal/app/applex"
"wa-lang.org/wa/internal/app/appllvm"
"wa-lang.org/wa/internal/app/applogo"
"wa-lang.org/wa/internal/app/applsp"
"wa-lang.org/wa/internal/app/appplay"
Expand Down Expand Up @@ -97,7 +96,6 @@ func Main() {
appssa.CmdSsa,

// 待完善的子命令(隐藏)
appllvm.CmdNative,
appcir.CmdCir,
appdoc.CmdDoc,
applsp.CmdLsp,
Expand Down
54 changes: 30 additions & 24 deletions internal/backends/compiler_c/cir/cconstant/cconstant.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//
package cconstant

import (
Expand All @@ -14,9 +13,11 @@ type Constant interface {
isConstant()
}

/**************************************
/*
*************************************
Zero: 0值常数
**************************************/
*************************************
*/
type Zero struct {
}

Expand All @@ -34,9 +35,11 @@ func (z *Zero) Type() ctypes.Type {

func (z *Zero) IsExpr() {}

/**************************************
/*
*************************************
Bool
**************************************/
*************************************
*/
type Bool struct {
x bool
}
Expand All @@ -58,9 +61,11 @@ func (b *Bool) Type() ctypes.Type {

func (b *Bool) IsExpr() {}

/**************************************
/*
*************************************
Int: 整型常数
**************************************/
*************************************
*/
type Int struct {
// 整数类型
typ *ctypes.IntType
Expand All @@ -75,12 +80,12 @@ func NewInt(t *ctypes.IntType, v int64) *Int {

// NewIntFromString() 从字符串中创建指定类型的整型常数
// 字符串可为以下形式之一:
// * boolean literal
// true | false
// * integer literal
// [-]?[0-9]+
// * hexadecimal integer literal
// [us]0x[0-9A-Fa-f]+
// - boolean literal
// true | false
// - integer literal
// [-]?[0-9]+
// - hexadecimal integer literal
// [us]0x[0-9A-Fa-f]+
func NewIntFromString(t *ctypes.IntType, s string) (*Int, error) {
// 布尔型
switch s {
Expand Down Expand Up @@ -138,8 +143,6 @@ func NewIntFromString(t *ctypes.IntType, s string) (*Int, error) {
return &Int{typ: t, x: v}, nil
}

// String returns the LLVM syntax representation of the constant as a type-value
// pair.
func (c *Int) CIRString() string {
return c.Ident()
}
Expand All @@ -158,15 +161,16 @@ func (c *Int) isConstant() {}

func (c *Int) IsExpr() {}

/**************************************
/*
*************************************
Float:
**************************************/
*************************************
*/
type Float struct {
// 常数值
x float32
}

//
func NewFloat(v float32) *Float {
return &Float{x: v}
}
Expand All @@ -181,15 +185,16 @@ func (f *Float) Type() ctypes.Type {

func (d *Float) IsExpr() {}

/**************************************
/*
*************************************
Double:
**************************************/
*************************************
*/
type Double struct {
// 常数值
x float64
}

//
func NewDouble(v float64) *Double {
return &Double{x: v}
}
Expand All @@ -204,15 +209,16 @@ func (d *Double) Type() ctypes.Type {

func (d *Double) IsExpr() {}

/**************************************
/*
*************************************
StringLit:
**************************************/
*************************************
*/
type StringLit struct {
//字符串字面值
x string
}

//
func NewStringLit(v string) *StringLit {
return &StringLit{x: v}
}
Expand Down
Loading

0 comments on commit d8636d1

Please sign in to comment.