aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2019-02-09 13:46:19 +0100
committerRon Evans <[email protected]>2019-02-19 09:08:13 +0100
commit856e5fa179defc6f08cdcfa746e5b1b7fd87687b (patch)
tree151e72356c7c65b98840322e5d2370912fda3d50
parent07733ca056445378c801e599758a5be493c3d4ec (diff)
downloadtinygo-856e5fa179defc6f08cdcfa746e5b1b7fd87687b.tar.gz
tinygo-856e5fa179defc6f08cdcfa746e5b1b7fd87687b.zip
ir: remove old cgo related code
There is now a custom implementation of CGo based on libclang.
-rw-r--r--ir/ir.go18
-rw-r--r--ir/passes.go4
2 files changed, 2 insertions, 20 deletions
diff --git a/ir/ir.go b/ir/ir.go
index 76758fbc2..524e50628 100644
--- a/ir/ir.go
+++ b/ir/ir.go
@@ -187,9 +187,6 @@ func NewProgram(lprogram *loader.Program, mainPath string) *Program {
func (p *Program) AddPackage(pkg *ssa.Package) {
memberNames := make([]string, 0)
for name := range pkg.Members {
- if isCGoInternal(name) {
- continue
- }
memberNames = append(memberNames, name)
}
sort.Strings(memberNames)
@@ -198,9 +195,6 @@ func (p *Program) AddPackage(pkg *ssa.Package) {
member := pkg.Members[name]
switch member := member.(type) {
case *ssa.Function:
- if isCGoInternal(member.Name()) {
- continue
- }
p.addFunction(member)
case *ssa.Type:
t := &NamedType{Type: member}
@@ -438,18 +432,6 @@ func (p *Program) IsVolatile(t types.Type) bool {
}
}
-// Return true if this is a CGo-internal function that can be ignored.
-func isCGoInternal(name string) bool {
- if strings.HasPrefix(name, "_Cgo_") || strings.HasPrefix(name, "_cgo") {
- // _Cgo_ptr, _Cgo_use, _cgoCheckResult, _cgo_runtime_cgocall
- return true // CGo-internal functions
- }
- if strings.HasPrefix(name, "__cgofn__cgo_") {
- return true // CGo function pointer in global scope
- }
- return false
-}
-
// Get all methods of a type.
func getAllMethods(prog *ssa.Program, typ types.Type) []*types.Selection {
ms := prog.MethodSets.MethodSet(typ)
diff --git a/ir/passes.go b/ir/passes.go
index a36664746..0fa7a4fdf 100644
--- a/ir/passes.go
+++ b/ir/passes.go
@@ -73,7 +73,7 @@ func (p *Program) SimpleDCE() {
worklist := []*ssa.Function{main}
for _, f := range p.Functions {
if f.exported || f.Synthetic == "package initializer" || f.Pkg == runtimePkg || (f.Pkg == mathPkg && f.Pkg != nil) {
- if f.flag || isCGoInternal(f.Name()) {
+ if f.flag {
continue
}
f.flag = true
@@ -103,7 +103,7 @@ func (p *Program) SimpleDCE() {
}
}
for _, operand := range instr.Operands(nil) {
- if operand == nil || *operand == nil || isCGoInternal((*operand).Name()) {
+ if operand == nil || *operand == nil {
continue
}
switch operand := (*operand).(type) {