Skip to content
Permalink
Browse files

cmd/ll2go: update to latest version of llir

  • Loading branch information...
mewmew committed Dec 8, 2018
1 parent d4c1fbe commit c77339efed031765e5d571349ba3a0d8982745df
Showing with 39 additions and 45 deletions.
  1. +1 −1 cmd/ll2go/instruction.go
  2. +15 −6 cmd/ll2go/main.go
  3. +4 −5 go.mod
  4. +19 −33 go.sum
@@ -300,7 +300,7 @@ func (d *decompiler) instExtractValue(inst *ir.InstExtractValue) ast.Stmt {
for _, index := range inst.Indices {
src = &ast.IndexExpr{
X: src,
Index: d.intLit(index),
Index: d.uintLit(index),
}
}
return d.assign(inst.LocalName, src)
@@ -171,7 +171,7 @@ func ll2go(llPath string, funcNames map[string]bool) (*ast.File, error) {
}

// Add newIntNNN function declarations.
var newIntSizes []int64
var newIntSizes []uint64
for newIntSize := range d.newIntSizes {
newIntSizes = append(newIntSizes, newIntSize)
}
@@ -210,7 +210,7 @@ func ll2go(llPath string, funcNames map[string]bool) (*ast.File, error) {
}

// Add types not part of builtin.
var intSizes []int64
var intSizes []uint64
for intSize := range d.intSizes {
switch intSize {
case 8, 16, 32, 64:
@@ -264,9 +264,9 @@ type decompiler struct {
// Global states.

// Tracks use of integer types not part of Go builtin.
intSizes map[int64]bool
intSizes map[uint64]bool
// Tracks use of newIntNNN function calls.
newIntSizes map[int64]bool
newIntSizes map[uint64]bool

// Per function states.

@@ -279,8 +279,8 @@ type decompiler struct {
// newDecompiler returns a new decompiler.
func newDecompiler() *decompiler {
return &decompiler{
intSizes: make(map[int64]bool),
newIntSizes: make(map[int64]bool),
intSizes: make(map[uint64]bool),
newIntSizes: make(map[uint64]bool),
}
}

@@ -536,6 +536,15 @@ func (d *decompiler) intLit(i int64) ast.Expr {
}
}

// uintLit converts the given unsigned integer literal into a corresponding Go
// expression.
func (d *decompiler) uintLit(i uint64) ast.Expr {
return &ast.BasicLit{
Kind: token.INT,
Value: fmt.Sprintf("%d", i),
}
}

// basicBlock represents a conceptual basic block, that may contain both LLVM IR
// instructions and Go statements.
type basicBlock struct {
9 go.mod
@@ -1,11 +1,10 @@
module github.com/decomp/decomp

require (
github.com/graphism/exp v0.0.0-20181114155108-95804a9f182b
github.com/graphism/simple v0.0.0-20181114131118-4c2595ff451f
github.com/llir/llvm v0.3.0-pre2.0.20181125212240-e76410922c5e
github.com/graphism/exp v0.0.0-20181208150744-60e1f9ae6685
github.com/graphism/simple v0.0.0-20181208150621-c42395dbfa50
github.com/llir/llvm v0.3.0-pre4
github.com/mewkiz/pkg v0.0.0-20181119122551-9729f4f4ff2b
github.com/pkg/errors v0.8.0
gonum.org/v1/gonum v0.0.0-20181115051416-e2f95e5c31f6
gonum.org/v1/netlib v0.0.0-20181029234149-ec6d1f5cefe6 // indirect
gonum.org/v1/gonum v0.0.0-20181208091643-b71a28080e0f
)
52 go.sum
@@ -1,54 +1,40 @@
bitbucket.org/zombiezen/cardcpx v0.0.0-20150417151802-902f68ff43ef h1:Uc8hUoyAlYy8huPnrqJC++v34avlqflgbQate6HLIfw=
bitbucket.org/zombiezen/cardcpx v0.0.0-20150417151802-902f68ff43ef/go.mod h1:ZJR5FpaQx7Bt2bzIV3gBaCInI1+kG949WhNYYlRr8eA=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/graphism/exp v0.0.0-20181114155108-95804a9f182b h1:T8pjZO7ViVNonro1f+BKdzvAsLxdqSfxZEMD+rFFp+s=
github.com/graphism/exp v0.0.0-20181114155108-95804a9f182b/go.mod h1:prUgw3Bvq7Q+xTO86BDz/Wqi58cwb9c311LROiQN7oM=
github.com/graphism/simple v0.0.0-20181114131118-4c2595ff451f h1:k+Td1EFp3pArxJVcWKB8/FuQCQl+Zek1bgAjf0q9UDQ=
github.com/graphism/simple v0.0.0-20181114131118-4c2595ff451f/go.mod h1:bPEKOGr2+oC/PxMfqp780oDwWJ/4vO27ArkaABmclJ8=
github.com/inspirer/textmapper v0.0.0-20181104204410-4bdb1fb0392a/go.mod h1:SpoIwXu07A3gguovN379QUCTHpUk1lhX2KIjVxpQOas=
github.com/inspirer/textmapper v0.0.0-20181111212404-973a0cda8bfa h1:h4DKmR668ZzPWziVPrpyE7bAHAMCSPSC9Q4+rrsz6p8=
github.com/inspirer/textmapper v0.0.0-20181111212404-973a0cda8bfa/go.mod h1:SpoIwXu07A3gguovN379QUCTHpUk1lhX2KIjVxpQOas=
github.com/graphism/exp v0.0.0-20181208150744-60e1f9ae6685 h1:9TMzM7bRC0lCmY8THiiNf2OI1TCIrV5AyFK7DAeOgOA=
github.com/graphism/exp v0.0.0-20181208150744-60e1f9ae6685/go.mod h1:GhC/PwcZ8bU9k1CN1f+jPClgqdXrZq6LRVFneaoZfh4=
github.com/graphism/simple v0.0.0-20181208150621-c42395dbfa50 h1:0dZv/2+dMWaPPFN6BMrBuq2Bh4jd5UmoED8iO543dYE=
github.com/graphism/simple v0.0.0-20181208150621-c42395dbfa50/go.mod h1:cox5q9v+f1rnFijpHx1qN0aS9dkJS4rFxCNHgcjBa8c=
github.com/inspirer/textmapper v0.0.0-20181202234051-312f7a0d146c h1:213Qb/08zOK1MMtHGdf8yuhnil4FcyJQpiP46PvLcCE=
github.com/inspirer/textmapper v0.0.0-20181202234051-312f7a0d146c/go.mod h1:SpoIwXu07A3gguovN379QUCTHpUk1lhX2KIjVxpQOas=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/pty v1.1.3/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/llir/ll v0.0.0-20181112013344-5eef2118d0e0/go.mod h1:a4JSuI2i1XkjU15LV11UxD243X6zJFuVeCHc63E/kGA=
github.com/llir/ll v0.0.0-20181113011500-98d5284f035c h1:sAr1ebtPqwOXjOMFYZ2TYqaWFLJAd4A3fBgmkBJcB4E=
github.com/llir/ll v0.0.0-20181113011500-98d5284f035c/go.mod h1:a4JSuI2i1XkjU15LV11UxD243X6zJFuVeCHc63E/kGA=
github.com/llir/ll v0.0.0-20181124143609-405448b26944 h1:0Ie0H7XbvWS+NCEelOaPU0QTpbUXjn+hVxzWQ2RRVQY=
github.com/llir/ll v0.0.0-20181124143609-405448b26944/go.mod h1:a4JSuI2i1XkjU15LV11UxD243X6zJFuVeCHc63E/kGA=
github.com/llir/llvm v0.3.0-pre1 h1:xC/snin1JpYMrPnNwfoGGuuyu5pc3kQlmYSCA8fXTM4=
github.com/llir/llvm v0.3.0-pre1/go.mod h1:rIRZQoU/ByzFwoA1usk4bFCkAprgzGwgGQ+Pw27n3ls=
github.com/llir/llvm v0.3.0-pre2.0.20181125212240-e76410922c5e h1:6LRfFwVo1Rt2lUr1w/BSM4wx1uq3R0wSkd9VQpZeRBo=
github.com/llir/llvm v0.3.0-pre2.0.20181125212240-e76410922c5e/go.mod h1:GjmZh4l6Kcz7/Q1G25oyiZuD2VqOWfHwnudPDaeArAE=
github.com/mewkiz/pkg v0.0.0-20181108225906-b4dee0c4e703 h1:dD6FYOywpJ718MbrtwFwcdkrxbSzX9CRX4TIVmf44Gc=
github.com/mewkiz/pkg v0.0.0-20181108225906-b4dee0c4e703/go.mod h1:bhmdGJSMX5WCIBFmk27tBnUvBJm5WxXmarBV41qvbNI=
github.com/llir/ll v0.0.0-20181207163918-0cfcde00de3f h1:OJxImTgaK6hQ8w6OOEeNox1LFsORsRxLVQidQCm04nA=
github.com/llir/ll v0.0.0-20181207163918-0cfcde00de3f/go.mod h1:jPRfHdh8JEos8a05CSejK/nIKptCRRixCfhg0zngzpg=
github.com/llir/llvm v0.3.0-pre4 h1:gRG6TiB2QsShFH8PG6vcz00LcwLtZcRX0AlCUbp+5fE=
github.com/llir/llvm v0.3.0-pre4/go.mod h1:5oQbQPEpQQem6CujHgRhfvDzTpCW5iinW3s+W33dG3w=
github.com/mewkiz/pkg v0.0.0-20181119122551-9729f4f4ff2b h1:XHFBx9ZEVHnSCRiTz7w1a/NRBk9x7iyFiqnoN6R+vu8=
github.com/mewkiz/pkg v0.0.0-20181119122551-9729f4f4ff2b/go.mod h1:bhmdGJSMX5WCIBFmk27tBnUvBJm5WxXmarBV41qvbNI=
github.com/mewmew/float v0.0.0-20181121163145-c0f786d7da73 h1:bTqCgPsW3TFb9MFtvaOmGFWVhCmN3EmRw02zkchdOHo=
github.com/mewmew/float v0.0.0-20181121163145-c0f786d7da73/go.mod h1:obQBs6O+vjhgOZLkGdALxItKw4xrI49lSBEnAMO6lWI=
github.com/mewmew/floats v0.0.0-20181110005823-891ed2b7ecb0 h1:gdC70byynYKy5XkR+8XoIMqudQhUc7iqe+aVi0GG17A=
github.com/mewmew/floats v0.0.0-20181110005823-891ed2b7ecb0/go.mod h1:w2cY+j509jzFA2pKozQ/ZBIdpO09JXQLWZ66iIpg7dE=
github.com/mewspring/tools v0.0.0-20181107085742-4dbfa080ff87 h1:F2Al+vk1BRMOIx0Sp7qIp4PfzgLlD8ItGsCx7O+b+nw=
github.com/mewspring/tools v0.0.0-20181107085742-4dbfa080ff87/go.mod h1:UAdVbSksr+7Bg+z4mga16OaBg3qAcgdaF3x3AeqJHEs=
github.com/mewspring/tools v0.0.0-20181204020634-6c6637dc82b6 h1:J/FwQ6PvTeHbDkhGt+nDlIXXGRdXUCqVdL85tmHflAg=
github.com/mewspring/tools v0.0.0-20181204020634-6c6637dc82b6/go.mod h1:UAdVbSksr+7Bg+z4mga16OaBg3qAcgdaF3x3AeqJHEs=
github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20181112044915-a3060d491354 h1:6UAgZ8309zQ9+1iWkHzfszFguqzOdHGyGkd1HmhJ+UE=
golang.org/x/exp v0.0.0-20181112044915-a3060d491354/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20181206211736-68cc7b1f272e h1:gTD8phFoxK/U3l0n5zSIC8MM5MQ2N19bEwBN7cEKNso=
golang.org/x/exp v0.0.0-20181206211736-68cc7b1f272e/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20181111003725-6d71ab8aade0/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20181114145209-99072bc9d7ad/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20181122213734-04b5d21e00f1 h1:bsEj/LXbv3BCtkp/rBj9Wi/0Nde4OMaraIZpndHAhdI=
golang.org/x/tools v0.0.0-20181122213734-04b5d21e00f1/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
gonum.org/v1/gonum v0.0.0-20181112092319-eb6a40d81aaf h1:K4WTYDNmuVbQMCze2I3keS8HzgSxSC23M64PCWN5hGc=
gonum.org/v1/gonum v0.0.0-20181112092319-eb6a40d81aaf/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo=
gonum.org/v1/gonum v0.0.0-20181115051416-e2f95e5c31f6 h1:Sv4KG3MNOeKJKMiAP1fqkOfZQJoYhqGf+jgelT7jH2o=
gonum.org/v1/gonum v0.0.0-20181115051416-e2f95e5c31f6/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo=
golang.org/x/tools v0.0.0-20181206194817-bcd4e47d0288/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20181207222222-4c874b978acb h1:YIXCxYolAiiPmVSqA4gVUVcHo8Mi1ivU7ANnK9a63JY=
golang.org/x/tools v0.0.0-20181207222222-4c874b978acb/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
gonum.org/v1/gonum v0.0.0-20181208091643-b71a28080e0f h1:mTXdxjj6u0sKi+UItZVxq7mfSaNBQFpeu0AOv8u/CCU=
gonum.org/v1/gonum v0.0.0-20181208091643-b71a28080e0f/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo=
gonum.org/v1/netlib v0.0.0-20181029234149-ec6d1f5cefe6 h1:4WsZyVtkthqrHTbDCJfiTs8IWNYE4uvsSDgaV6xpp+o=
gonum.org/v1/netlib v0.0.0-20181029234149-ec6d1f5cefe6/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw=

0 comments on commit c77339e

Please sign in to comment.
You can’t perform that action at this time.