cl(feat):llgo.asm implement tinygo.Asm#1217
Merged
xushiwei merged 2 commits intogoplus:mainfrom Aug 19, 2025
Merged
Conversation
test:asm test with `nop`
luoliwoshang
commented
Aug 17, 2025
| func main() { | ||
| start := time.Now() | ||
| for i := 0; i < 100000; i++ { | ||
| asm("nop") |
Member
Author
There was a problem hiding this comment.
NOTE:single asm call seems hardly to make a directive function verification
xushiwei
reviewed
Aug 17, 2025
cl/import.go
Outdated
| llgoCgoCheckPointer = llgoCgoBase + 0x6 | ||
| llgoCgoCgocall = llgoCgoBase + 0x7 | ||
|
|
||
| llgoAsmBase = llgoInstrBase + 0x40 |
Member
There was a problem hiding this comment.
asm don't have many instructions, so we don't need llgoAsmBase.
Member
Author
There was a problem hiding this comment.
got it, we can determine whether the instruction corresponds to a complex or simple implementation based on the number of parameters.
remove llgoAsmBase at afee2be
8 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolved #1216
Implements
llgo.asmcompiler directive for inline assembly, following the existing LLGo instruction pattern.Usage
https://llvm.org/docs/LangRef.html#inline-assembler-expressions
This explains why inline assembly appears as
call void asm sideeffect "nop", ""()in LLVM IR. This is not an actual function call, but rather the structured syntax required by LLVM IR to represent inline assembly code within its type-safe intermediate representation.