diff --git a/www/makeweb.py b/www/makeweb.py index 7dc334e..de955b3 100755 --- a/www/makeweb.py +++ b/www/makeweb.py @@ -11,6 +11,12 @@ SKIP_FILES = [ 'layout.conf', '.svn', 'instrset.inc' ] # asciidoc command line ASCIIDOC = 'asciidoc --unsafe --conf-file=${srcdir}/layout.conf -a icons -o ${outfile} ${infile}' +# specialized ASCIIDOC for certain files +# - this is a hack trying to look generic +ASCIIDOC_PERFILE = { + 'userguide.txt': ASCIIDOC.replace('-a icons', '-a icons -a toc') +} + def _is_older(inp, outp): older = True @@ -29,7 +35,8 @@ def asciidoc(opts, srcdir, inp, outp): if _is_older(inp, outp) or opts.force: if opts.verbose: print "asciidoc %s -> %s" % (inp, outp) - cmd = Template(ASCIIDOC).substitute(srcdir=srcdir, infile=inp, outfile=outp) + asciidoc = ASCIIDOC_PERFILE.get(os.path.split(inp)[-1], ASCIIDOC) + cmd = Template(asciidoc).substitute(srcdir=srcdir, infile=inp, outfile=outp) if opts.verbose >= 3: print "asciidoc command is [%s]" % cmd if not opts.dryrun: diff --git a/www/src/contribute.txt b/www/src/contribute.txt index 01cbe9b..886d0b4 100644 --- a/www/src/contribute.txt +++ b/www/src/contribute.txt @@ -5,7 +5,7 @@ llvm-py is just hatching. It needs your patches and suggestions to grow up. Please contribute! All patches are welcome. Here are some links to start hacking away: -`40`60~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +`75`25~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Google code hosting, http://code.google.com/p/llvm-py/[http://code.google.com/p/llvm-py/] Browse SVN, http://code.google.com/p/llvm-py/source/browse/[http://code.google.com/p/llvm-py/source/browse] Issues tracker, http://code.google.com/p/llvm-py/issues/list[http://code.google.com/p/llvm-py/issues/list] @@ -24,6 +24,7 @@ Current Next Steps ------------------ - Wrap GenericValue, function call args for execution engine. + * done. - Add APIs to read/write `.bc` and `.ll` files. - Wrap `lto`. - Add examples. diff --git a/www/src/js/toc.js b/www/src/js/toc.js new file mode 100644 index 0000000..a8437ba --- /dev/null +++ b/www/src/js/toc.js @@ -0,0 +1,67 @@ +/* Author: Mihai Bazon, September 2002 + * http://students.infoiasi.ro/~mishoo + * + * Table Of Content generator + * Version: 0.4 + * + * Feel free to use this script under the terms of the GNU General Public + * License, as long as you do not remove or alter this notice. + */ + + /* modified by Troy D. Hanson, September 2006. License: GPL */ + /* modified by Stuart Rackham, October 2006. License: GPL */ + +function getText(el) { + var text = ""; + for (var i = el.firstChild; i != null; i = i.nextSibling) { + if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants. + text += i.data; + else if (i.firstChild != null) + text += getText(i); + } + return text; +} + +function TocEntry(el, text, toclevel) { + this.element = el; + this.text = text; + this.toclevel = toclevel; +} + +function tocEntries(el, toclevels) { + var result = new Array; + var re = new RegExp('[hH]([2-'+(toclevels+1)+'])'); + // Function that scans the DOM tree for header elements (the DOM2 + // nodeIterator API would be a better technique but not supported by all + // browsers). + var iterate = function (el) { + for (var i = el.firstChild; i != null; i = i.nextSibling) { + if (i.nodeType == 1 /* Node.ELEMENT_NODE */) { + var mo = re.exec(i.tagName) + if (mo) + result[result.length] = new TocEntry(i, getText(i), mo[1]-1); + iterate(i); + } + } + } + iterate(el); + return result; +} + +// This function does the work. toclevels = 1..4. +function generateToc(toclevels) { + var toc = document.getElementById("toc"); + var entries = tocEntries(document.getElementsByTagName("body")[0], toclevels); + for (var i = 0; i < entries.length; ++i) { + var entry = entries[i]; + if (entry.element.id == "") + entry.element.id = "toc" + i; + var a = document.createElement("a"); + a.href = "#" + entry.element.id; + a.appendChild(document.createTextNode(entry.text)); + var div = document.createElement("div"); + div.appendChild(a); + div.className = "toclevel" + entry.toclevel; + toc.appendChild(div); + } +} diff --git a/www/src/layout.conf b/www/src/layout.conf index ec0f087..768f832 100644 --- a/www/src/layout.conf +++ b/www/src/layout.conf @@ -41,6 +41,14 @@ monospacedwords=(?u)\\?\basciidoc\(1\) (?u)\\?\ba2x\(1\) +ifdef::toc[] + + +endif::toc[]
llvm-py provides Python bindings for LLVM. This document explains how @@ -1672,6 +1681,693 @@ tr = Type= Constant.real(tr, "3.141592") # create from a string r2 = Constant.real(tr, 1.61803399) # create from a Python float
The following constructors (static methods) can be used to create +constants:
+| + Constructor Method + | ++ What It Creates + | +
|---|---|
| + null(ty) + | ++ A null value (all zeros) of type ty + | +
| + all_ones(ty) + | ++ All 1's value of type ty + | +
| + undef(ty) + | ++ An “undefined” value of type ty + | +
| + int(ty, value) + | ++ Integer of type ty, with value value (a Python int or long) + | +
| + int_signextend(ty, value) + | ++ Integer of signed type ty (use for signed types) + | +
| + real(ty, value) + | ++ Floating point value of type ty, with value value (a Python float) + | +
| + stringz(value) + | ++ A null-terminated string. value is a Python string + | +
| + string(value) + | ++ As string(ty), but not null terminated + | +
| + array(ty, consts) + | ++ Array of type ty, initialized with consts (an iterable yielding Constant objects of the appropriate type) + | +
| + struct(ty, consts) + | ++ Struct (unpacked) of type ty, initialized with consts (an iterable yielding Constant objects of the appropriate type) + | +
| + packed_struct(ty, consts) + | ++ As struct(ty, consts) but packed + | +
| + vector(consts) + | ++ Vector, initialized with consts (an iterable yielding Constant objects of the appropriate type) + | +
| + sizeof(ty) + | ++ Constant value representing the sizeof the type ty + | +
The following operations are available:
+| + Method + | ++ Operation + | +
|---|---|
| + k.neg() + | ++ negation, same as 0 - k + | +
| + k.not_() + | ++ 1's complement of k. Note trailing underscore. + | +
| + k.add(k2) + | ++ k + k2 + | +
| + k.sub(k2) + | ++ k - k2 + | +
| + k.mul(k2) + | ++ k * k2 + | +
| + k.udiv(k2) + | ++ Quotient of unsigned division of k with k2 + | +
| + k.sdiv(k2) + | ++ Quotient of signed division of k with k2 + | +
| + k.fdiv(k2) + | ++ Quotient of floating point division of k with k2 + | +
| + k.urem(k2) + | ++ Reminder of unsigned division of k with k2 + | +
| + k.srem(k2) + | ++ Reminder of signed division of k with k2 + | +
| + k.frem(k2) + | ++ Reminder of floating point division of k with k2 + | +
| + k.and_(k2) + | ++ Bitwise and of k and k2. Note trailing underscore. + | +
| + k.or_(k2) + | ++ Bitwise or of k and k2. Note trailing underscore. + | +
| + k.xor(k2) + | ++ Bitwise exclusive-or of k and k2. + | +
| + k.icmp(ipred, k2) + | ++ Compare k with k2 using the predicate ipred. See table below for list of predicates for integer operands. + | +
| + k.fcmp(rpred, k2) + | ++ Compare k with k2 using the predicate rpred. See table below for list of predicates for real operands. + | +
| + shl + | ++ TODO + | +
| + lshr + | ++ TODO + | +
| + ashr + | ++ TODO + | +
| + gep + | ++ TODO + | +
| + trunc + | ++ TODO + | +
| + sext + | ++ TODO + | +
| + zext + | ++ TODO + | +
| + fptrunc + | ++ TODO + | +
| + fpext + | ++ TODO + | +
| + uitofp + | ++ TODO + | +
| + sitofp + | ++ TODO + | +
| + fptoui + | ++ TODO + | +
| + fptosi + | ++ TODO + | +
| + ptrtoint + | ++ TODO + | +
| + inttoptr + | ++ TODO + | +
| + bitcast + | ++ TODO + | +
| + select + | ++ TODO + | +
| + extract_element + | ++ TODO + | +
| + insert_element + | ++ TODO + | +
| + shuffle_vector + | ++ TODO + | +
Predicates for use with icmp instruction are listed below. All +of these are integer constants defined in the llvm.core module.
+| + Value + | ++ Meaning + | +
|---|---|
| + IPRED_EQ + | ++ Equality + | +
| + IPRED_NE + | ++ Inequality + | +
| + IPRED_UGT + | ++ Unsigned greater than + | +
| + IPRED_UGE + | ++ Unsigned greater than or equal + | +
| + IPRED_ULT + | ++ Unsigned less than + | +
| + IPRED_ULE + | ++ Unsigned less than or equal + | +
| + IPRED_SGT + | ++ Signed greater than + | +
| + IPRED_SGE + | ++ Signed greater than or equal + | +
| + IPRED_SLT + | ++ Signed less than + | +
| + IPRED_SLE + | ++ Signed less than or equal + | +
Predicates for use with fcmp instruction are listed below. All +of these are integer constants defined in the llvm.core module.
+| + Value + | ++ Meaning + | +
|---|---|
| + RPRED_FALSE + | ++ + | +
| + RPRED_OEQ + | ++ + | +
| + RPRED_OGT + | ++ + | +
| + RPRED_OGE + | ++ + | +
| + RPRED_OLT + | ++ + | +
| + RPRED_OLE + | ++ + | +
| + RPRED_ONE + | ++ + | +
| + RPRED_ORD + | ++ + | +
| + RPRED_UNO + | ++ + | +
| + RPRED_UEQ + | ++ + | +
| + RPRED_UGT + | ++ + | +
| + RPRED_UGE + | ++ + | +
| + RPRED_ULT + | ++ + | +
| + RPRED_ULE + | ++ + | +
| + RPRED_UNE + | ++ + | +
| + RPRED_TRUE + | ++ + | +
TODO