aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/clang/llvm-extract/llvm-extract.1
blob: b5f3550e8f76e98146f2e30ae8fa6f2e6ec44132 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
.\" Man page generated from reStructuredText.
.
.
.nr rst2man-indent-level 0
.
.de1 rstReportMargin
\\$1 \\n[an-margin]
level \\n[rst2man-indent-level]
level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
-
\\n[rst2man-indent0]
\\n[rst2man-indent1]
\\n[rst2man-indent2]
..
.de1 INDENT
.\" .rstReportMargin pre:
. RS \\$1
. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
. nr rst2man-indent-level +1
.\" .rstReportMargin post:
..
.de UNINDENT
. RE
.\" indent \\n[an-margin]
.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
.nr rst2man-indent-level -1
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
.TH "LLVM-EXTRACT" "1" "2023-05-24" "16" "LLVM"
.SH NAME
llvm-extract \- extract a function from an LLVM module
.SH SYNOPSIS
.sp
\fBllvm\-extract\fP [\fIoptions\fP] \fB\-\-func\fP \fIfunction\-name\fP [\fIfilename\fP]
.SH DESCRIPTION
.sp
The \fBllvm\-extract\fP command takes the name of a function and extracts
it from the specified LLVM bitcode file.  It is primarily used as a debugging
tool to reduce test cases from larger programs that are triggering a bug.
.sp
In addition to extracting the bitcode of the specified function,
\fBllvm\-extract\fP will also remove unreachable global variables,
prototypes, and unused types.
.sp
The \fBllvm\-extract\fP command reads its input from standard input if
filename is omitted or if filename is \fB\-\fP\&.  The output is always written to
standard output, unless the \fB\-o\fP option is specified (see below).
.SH OPTIONS
.sp
\fB\-\-alias\fP \fIalias\-name\fP
.INDENT 0.0
.INDENT 3.5
Extract the alias named \fIfunction\-name\fP from the LLVM bitcode.  May be
specified multiple times to extract multiple alias at once.
.UNINDENT
.UNINDENT
.sp
\fB\-\-ralias\fP \fIalias\-regular\-expr\fP
.INDENT 0.0
.INDENT 3.5
Extract the alias matching \fIalias\-regular\-expr\fP from the LLVM bitcode.
All alias matching the regular expression will be extracted.  May be
specified multiple times.
.UNINDENT
.UNINDENT
.sp
\fB\-\-bb\fP \fIbasic\-block\-specifier\fP
.INDENT 0.0
.INDENT 3.5
Extract basic blocks(s) specified in \fIbasic\-block\-specifier\fP\&. May be
specified multiple times. Each <function:bb[;bb]> specifier pair will create
a function. If multiple basic blocks are specified in one pair, the first
block in the sequence should dominate the rest.
.UNINDENT
.UNINDENT
.sp
\fB\-\-delete\fP
.INDENT 0.0
.INDENT 3.5
Delete specified Globals from Module.
.UNINDENT
.UNINDENT
.sp
\fB\-f\fP
.INDENT 0.0
.INDENT 3.5
Enable binary output on terminals.  Normally, \fBllvm\-extract\fP will
refuse to write raw bitcode output if the output stream is a terminal.  With
this option, \fBllvm\-extract\fP will write raw bitcode regardless of the
output device.
.UNINDENT
.UNINDENT
.sp
\fB\-\-func\fP \fIfunction\-name\fP
.INDENT 0.0
.INDENT 3.5
Extract the function named \fIfunction\-name\fP from the LLVM bitcode.  May be
specified multiple times to extract multiple functions at once.
.UNINDENT
.UNINDENT
.sp
\fB\-\-rfunc\fP \fIfunction\-regular\-expr\fP
.INDENT 0.0
.INDENT 3.5
Extract the function(s) matching \fIfunction\-regular\-expr\fP from the LLVM bitcode.
All functions matching the regular expression will be extracted.  May be
specified multiple times.
.UNINDENT
.UNINDENT
.sp
\fB\-\-glob\fP \fIglobal\-name\fP
.INDENT 0.0
.INDENT 3.5
Extract the global variable named \fIglobal\-name\fP from the LLVM bitcode.  May be
specified multiple times to extract multiple global variables at once.
.UNINDENT
.UNINDENT
.sp
\fB\-\-rglob\fP \fIglob\-regular\-expr\fP
.INDENT 0.0
.INDENT 3.5
Extract the global variable(s) matching \fIglobal\-regular\-expr\fP from the LLVM
bitcode.  All global variables matching the regular expression will be
extracted.  May be specified multiple times.
.UNINDENT
.UNINDENT
.sp
\fB\-\-keep\-const\-init\fP
.INDENT 0.0
.INDENT 3.5
Preserve the values of constant globals.
.UNINDENT
.UNINDENT
.sp
\fB\-\-recursive\fP
.INDENT 0.0
.INDENT 3.5
Recursively extract all called functions
.UNINDENT
.UNINDENT
.sp
\fB\-help\fP
.INDENT 0.0
.INDENT 3.5
Print a summary of command line options.
.UNINDENT
.UNINDENT
.sp
\fB\-o\fP \fIfilename\fP
.INDENT 0.0
.INDENT 3.5
Specify the output filename.  If filename is \(dq\-\(dq (the default), then
\fBllvm\-extract\fP sends its output to standard output.
.UNINDENT
.UNINDENT
.sp
\fB\-S\fP
.INDENT 0.0
.INDENT 3.5
Write output in LLVM intermediate language (instead of bitcode).
.UNINDENT
.UNINDENT
.SH EXIT STATUS
.sp
If \fBllvm\-extract\fP succeeds, it will exit with 0.  Otherwise, if an error
occurs, it will exit with a non\-zero value.
.SH SEE ALSO
.sp
\fBbugpoint(1)\fP
.SH AUTHOR
Maintained by the LLVM Team (https://llvm.org/).
.SH COPYRIGHT
2003-2023, LLVM Project
.\" Generated by docutils manpage writer.
.