Skip to content

Commit fa2da43

Browse files
committed
readme: update to add link to GoDoc "hello world" example
Also, remove link to [1]. Info is mostly contained within example code (i.e. convert from *[15]i8 to *i8). [1]: https://github.com/anoopsarkar/compilers-class-hw/blob/master/llvm-practice/helloworld.ll
1 parent 10625b0 commit fa2da43

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

README.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Map between `llir/llvm` tagged releases and LLVM release versions.
4242

4343
## Usage
4444

45-
### Input example - Parse LLVM IR assembly
45+
### Input example, parsing LLVM IR assembly
4646

4747
[Example usage in GoDoc](https://pkg.go.dev/github.com/llir/llvm/asm#example-package).
4848

@@ -73,8 +73,10 @@ func main() {
7373

7474
#### Hello, World
7575

76+
[Example usage in GoDoc](https://pkg.go.dev/github.com/llir/llvm/ir#example-package-Hello).
77+
7678
```go
77-
// This example produces LLVM IR generating "Hello, World" output:
79+
// This example produces LLVM IR generating "Hello, World" output.
7880

7981
package main
8082

@@ -95,15 +97,13 @@ func main() {
9597
puts := m.NewFunc("puts", types.I32, ir.NewParam("", types.NewPointer(types.I8)))
9698
main := m.NewFunc("main", types.I32)
9799
entry := main.NewBlock("")
98-
// Cast *[15]i8 to *i8; c.f.: [1]
100+
// Cast *[15]i8 to *i8.
99101
zero := constant.NewInt(types.I64, 0)
100102
gep := constant.NewGetElementPtr(hello.Typ, str, zero, zero)
101103
entry.NewCall(puts, gep)
102104
entry.NewRet(constant.NewInt(types.I32, 0))
103105
fmt.Println(m)
104106
}
105-
// [1] See also:
106-
// https://github.com/anoopsarkar/compilers-class-hw/blob/master/llvm-practice/helloworld.ll
107107
```
108108

109109
#### Pseudo Random-Number Generator
@@ -176,9 +176,9 @@ func main() {
176176
}
177177
```
178178

179-
### Analysis example - Process LLVM IR
179+
### Analysis example, processing LLVM IR
180180

181-
[Example usage in GoDoc](https://pkg.go.dev/github.com/llir/llvm/ir#example-package--Callgraph).
181+
[Example usage in GoDoc](https://pkg.go.dev/github.com/llir/llvm/ir#example-package-Callgraph).
182182

183183
```go
184184
// This example program analyses an LLVM IR module to produce a callgraph in

ir/hello_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,4 @@ func Example_hello() {
3333
// %1 = call i32 @puts(i8* getelementptr ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
3434
// ret i32 0
3535
// }
36-
3736
}

0 commit comments

Comments
 (0)