Updated intrinsic ids.
git-svn-id: http://llvm-py.googlecode.com/svn/trunk@61 8d1e9007-1d4e-0410-b67e-1979fd6579aa
This commit is contained in:
parent
39b55e950c
commit
75161701a1
2 changed files with 628 additions and 582 deletions
1178
llvm/core.py
1178
llvm/core.py
File diff suppressed because it is too large
Load diff
32
tools/intrgen.py
Executable file
32
tools/intrgen.py
Executable file
|
|
@ -0,0 +1,32 @@
|
|||
#!/usr/bin/env python
|
||||
#
|
||||
# Script to generate intrinsic IDs (found in core.py) from
|
||||
# <llvm>/include/llvm/Intrinsics.gen. Call with path to the
|
||||
# latter.
|
||||
|
||||
import sys
|
||||
|
||||
def gen(f):
|
||||
intr = []
|
||||
maxw = 0
|
||||
flag = False
|
||||
for line in open(f):
|
||||
if line.startswith('#ifdef GET_INTRINSIC_ENUM_VALUES'):
|
||||
flag = True
|
||||
elif flag:
|
||||
if line.startswith('#endif'):
|
||||
break
|
||||
else:
|
||||
item = line.split()[0].replace(',', '')
|
||||
if len(item) > maxw:
|
||||
maxw = len(item)
|
||||
intr.append(item)
|
||||
|
||||
maxw = len('INTR_') + maxw
|
||||
idx = 1
|
||||
for i in intr:
|
||||
s = 'INTR_' + i.upper()
|
||||
print '%s = %d' % (s.ljust(maxw), idx)
|
||||
idx += 1
|
||||
|
||||
gen(sys.argv[1])
|
||||
Loading…
Add table
Add a link
Reference in a new issue