Datasets:
Tasks:
Text Generation
Modalities:
Text
Formats:
parquet
Languages:
code
Size:
10K - 100K
ArXiv:
DOI:
License:
boomanaiden154
commited on
Commit
•
1746762
1
Parent(s):
41efbe0
Update README.md
Browse filesAdd information on getting textual IR out of the dataset.
README.md
CHANGED
@@ -117,6 +117,23 @@ next(iter(ds))
|
|
117 |
ds[0]
|
118 |
```
|
119 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
Filtering and map operations can be performed with the primitives available within the
|
121 |
HuggingFace `datasets` library.
|
122 |
|
|
|
117 |
ds[0]
|
118 |
```
|
119 |
|
120 |
+
If you're interested in getting textual IR instead of bitcode, you can simply run `llvm-dis`
|
121 |
+
over the bitcode which will return the IR in textual form. Using Python's `subprocess` module
|
122 |
+
to do this looks something like this:
|
123 |
+
|
124 |
+
```python
|
125 |
+
bitcode_module = next(iter(ds))['content']
|
126 |
+
dis_command_vector = ['llvm-dis', '-']
|
127 |
+
with subprocess.Popen(
|
128 |
+
dis_command_vector,
|
129 |
+
stdout=subprocess.PIPE,
|
130 |
+
stderr=subprocess.STDOUT,
|
131 |
+
stdin=subprocess.PIPE) as dis_process:
|
132 |
+
output = dis_process.communicate(
|
133 |
+
input=bitcode_module)[0].decode('utf-8')
|
134 |
+
# the variable output contains the textual IR that can be used downstream.
|
135 |
+
```
|
136 |
+
|
137 |
Filtering and map operations can be performed with the primitives available within the
|
138 |
HuggingFace `datasets` library.
|
139 |
|