summaryrefslogtreecommitdiffstats
path: root/llgo/test
Commit message (Collapse)AuthorAgeFilesLines
* IR: Support parsing numeric block ids, and emit them in textual output.James Y Knight2019-03-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Just as as llvm IR supports explicitly specifying numeric value ids for instructions, and emits them by default in textual output, now do the same for blocks. This is a slightly incompatible change in the textual IR format. Previously, llvm would parse numeric labels as string names. E.g. define void @f() { br label %"55" 55: ret void } defined a label *named* "55", even without needing to be quoted, while the reference required quoting. Now, if you intend a block label which looks like a value number to be a name, you must quote it in the definition too (e.g. `"55":`). Previously, llvm would print nameless blocks only as a comment, and would omit it if there was no predecessor. This could cause confusion for readers of the IR, just as unnamed instructions did prior to the addition of "%5 = " syntax, back in 2008 (PR2480). Now, it will always print a label for an unnamed block, with the exception of the entry block. (IMO it may be better to print it for the entry-block as well. However, that requires updating many more tests.) Thus, the following is supported, and is the canonical printing: define i32 @f(i32, i32) { %3 = add i32 %0, %1 br label %4 4: ret i32 %3 } New test cases covering this behavior are added, and other tests updated as required. Differential Revision: https://reviews.llvm.org/D58548 llvm-svn: 356789
* [llgo] llgoi: separate evaluation from printingAndrew Wilkins2016-04-256-33/+38
| | | | | | | | | | | | | | | | | | | | | | | | Summary: Separate the evaluation of expressions from printing of results. This is in preparation for splitting the core of the interpreter out for use in alternative interpreter frontends. At the same time, the output is made less noisy in response to comments on the golang-nuts announcement. We would ideally print out values using Go syntax, but this is impractical until we have libgo based on Go 1.5. When that happens, fmt's %#v will handle reflect.Value better, and so we can fix/filter type names to remove automatically generated package names. Reviewers: pcc Subscribers: llvm-commits, axw Differential Revision: http://reviews.llvm.org/D13761 llvm-svn: 267374
* Roll gofrontend to 07baa07598ea; roll libffi to r219477.Peter Collingbourne2015-04-053-14/+14
| | | | | | | | | Incorporates https://codereview.appspot.com/198770044, which causes us to start using the static chain register for closures instead of __go_{get,set}_closure. Differential Revision: http://reviews.llvm.org/D8829 llvm-svn: 234135
* llgoi: Fix type identity for imported binary packages.Peter Collingbourne2015-03-181-1/+11
| | | | | | | | | | | | go/loader creates a fresh package map for each source package it imports. In llgoi this caused binary imported packages to be imported anew for every input line, resulting in spurious type errors and panics in go/ssa when encountering previously imported types. Fix this by setting types.Config.Packages to our internal package map. Differential Revision: http://reviews.llvm.org/D8409 llvm-svn: 232617
* llgoi: Fix importing source packages together with dependent binary packages.Peter Collingbourne2015-03-183-1/+24
| | | | | | | | | | Note that this means that llgoi does not support the case where a package's pkgpath is different from its import path, but I don't think this should actually happen with llgoi. Differential Revision: http://reviews.llvm.org/D8403 llvm-svn: 232612
* Fix test to use explicit load type.Peter Collingbourne2015-03-051-1/+1
| | | | llvm-svn: 231417
* Introduce llgoi, a REPL for GoPeter Collingbourne2015-01-1512-1/+132
| | | | | | | | | | llgoi is a Go REPL based on llgo irgen and the LLVM JIT. It supports expressions, statements, most declarations and imports, including binary imports from the standard library and source imports from $GOPATH. Differential Revision: http://reviews.llvm.org/D6957 llvm-svn: 226097
* [llgo] irgen: generate switch instructionsAndrew Wilkins2015-01-081-0/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: With this patch, llgo uses ssautil.Switches to reconstitute (and synthesise) switches, which can then be lowered to lookup tables, trees, etc. We currently only handle integer const case switches. We erase the comparison blocks (other than the initial block), and generate a switch instruction at the end of the block starting the if-else-if chain. ssautil.Switches does not remove duplicate const cases (e.g. same operands for "||"), so we do this in llgo for now. Test Plan: lit test added Reviewers: pcc Reviewed By: pcc Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D6831 llvm-svn: 225433
* [llgo] Elide alloca for unused received values in selectAndrew Wilkins2014-12-311-0/+18
| | | | | | | | | | | | | | | | Summary: If a receive case in a select statement is not assigned to a named variable, then we can eliminate the alloca and copy at runtime. Test Plan: lit test added Reviewers: pcc Reviewed By: pcc Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D6785 llvm-svn: 225033
* irgen: modify the ABI to use init guards instead of priorityPeter Collingbourne2014-12-311-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | The new ABI is simpler for use cases such as dynamically loaded packages. The calling convention for import functions is similar to what go/ssa would produce if BareInits were cleared. However, simply clearing this flag causes two additional issues: 1) We would need to special case the 'init$guard' variable (see discussion in https://codereview.appspot.com/78780043/). 2) The call to __go_register_gc_roots needs to appear in the right place, i.e. after the guard check. Making this check appear in the right place with non-bare inits seems unreliable at best. So we keep BareInits set and generate the necessary code manually. It is still possible to get the old ABI by specifying a path to a gccgo installation. Differential Revision: http://reviews.llvm.org/D6804 llvm-svn: 225030
* irgen: do not emit an extra terminator for panic thunksPeter Collingbourne2014-12-281-0/+10
| | | | | | | | Found with GoSmith. Differential Revision: http://reviews.llvm.org/D6714 llvm-svn: 224904
* irgen: fix canAvoid*Peter Collingbourne2014-12-171-0/+15
| | | | | | | | | | | | | | | | Patch by Andrew Wilkins! canAvoidElementLoad and canAvoidLoad were incorrectly eliding loads when an index expression is used as an another array index expression. This led to a panic. See comments on https://github.com/go-llvm/llgo/issues/175 Test Plan: lit test added Differential Revision: http://reviews.llvm.org/D6676 llvm-svn: 224420
* Use the object's package to mangle method names, rather than the receiver's ↵Peter Collingbourne2014-12-163-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | package If we use the receiver's package, we can end up with identical manglings for different functions. Consider: package p type U struct{} func (U) f() package q import "p" type T struct { p.U } func (T) f() The method set of *T has two synthetic methods named (*T).f(); one forwards to (T).f(), and the other to (U).f(). Previously, we were distinguishing them by the receiver's package, and in this case because both methods have the same receiver, they received the same name. The methods are correctly distinguished by the package owning the identifier "f", which is available via f.Object().Pkg(). Differential Revision: http://reviews.llvm.org/D6673 llvm-svn: 224357
* Initial commit of llgo.Peter Collingbourne2014-11-27105-0/+4229
llvm-svn: 222857
OpenPOWER on IntegriCloud