Skip to content

Commit 6fd682d

Browse files
committed
builder/createInlineAsm:with independant logic to avoid goto operate
1 parent 633688c commit 6fd682d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

compiler/inlineasm.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ func (b *builder) createInlineAsm(args []ssa.Value) (llvm.Value, error) {
2929
return b.CreateCall(fnType, target, nil, ""), nil
3030
}
3131

32+
3233
// This is a compiler builtin, which allows assembly to be called in a flexible
3334
// way.
3435
//
@@ -46,7 +47,9 @@ func (b *builder) createInlineAsm(args []ssa.Value) (llvm.Value, error) {
4647
func (b *builder) createInlineAsmFull(instr *ssa.CallCommon) (llvm.Value, error) {
4748
asmString := constant.StringVal(instr.Args[0].(*ssa.Const).Value)
4849
registers := map[string]llvm.Value{}
50+
4951
if registerMap, ok := instr.Args[1].(*ssa.MakeMap); ok {
52+
referrers:
5053
for _, r := range *registerMap.Referrers() {
5154
switch r := r.(type) {
5255
case *ssa.DebugRef:
@@ -61,13 +64,12 @@ func (b *builder) createInlineAsmFull(instr *ssa.CallCommon) (llvm.Value, error)
6164
if r.Common() == instr {
6265
// Stop processing when we encounter the AsmFull call itself
6366
// to avoid including MapUpdate operations that happen after the call
64-
goto done
67+
break referrers
6568
}
6669
default:
6770
return llvm.Value{}, b.makeError(instr.Pos(), "don't know how to handle argument to inline assembly: "+r.String())
6871
}
6972
}
70-
done:
7173
}
7274
// TODO: handle dollar signs in asm string
7375
registerNumbers := map[string]int{}

0 commit comments

Comments
 (0)