Commit Graph

10 Commits

Author SHA1 Message Date
Chris Lattner
00e961e5f2 Teach the SILPrinter to be more resilient to null operands.
Previously, when in the debugger and dumping out SIL code, the
printer would crash if it encountered a null operand.  If you
are dumping a basic block, this means that the dump stops at
that instruction instead of showing you the whole block.  Null
operands can happen when you call dropAllReferences() but have
yet to delete the instruction.

Now the printer is a bit more resilient.  We probably don't catch
all the cases, but we handle a lot of them, e.g.:

  %116 = apply <<NULL OPERAND>>(<<NULL OPERAND>>, <<NULL OPERAND>>) : <<NULL CALLEE>>
  debug_value <<NULL OPERAND>>, let, name "c", argno 1 // id: %120
  retain_value <<NULL OPERAND>>                   // id: %138

Since this is only relevant to invalid IR, this is just
a debugging aid, so no testcase.
2017-12-21 14:29:56 -08:00
John McCall
ab3f77baf2 Make SILInstruction no longer a subclass of ValueBase and
introduce a common superclass, SILNode.

This is in preparation for allowing instructions to have multiple
results.  It is also a somewhat more elegant representation for
instructions that have zero results.  Instructions that are known
to have exactly one result inherit from a class, SingleValueInstruction,
that subclasses both ValueBase and SILInstruction.  Some care must be
taken when working with SILNode pointers and testing for equality;
please see the comment on SILNode for more information.

A number of SIL passes needed to be updated in order to handle this
new distinction between SIL values and SIL instructions.

Note that the SIL parser is now stricter about not trying to assign
a result value from an instruction (like 'return' or 'strong_retain')
that does not produce any.
2017-09-25 02:06:26 -04:00
Erik Eckstein
24b684b22d SILPrinter: allow also basic blocks to be a context.
Plus a small refactoring to simplify the code: remove the inner SILPrintFunctionContext struct
2017-08-23 09:15:00 -07:00
Erik Eckstein
d4db9b8099 SILPrinter: make the printing of debug info optional.
With the option -sil-print-debuginfo the printing of debug locations and scopes can be enabled.

I made the default for the option “false”, because in 99% of the time I don’t need the debug info in the printed SIL and I prefer better readability.
2017-04-20 09:18:08 -07:00
practicalswift
7eb7d5b109 [gardening] Fix 100 typos. 2017-04-18 17:01:42 +02:00
Andrew Trick
7ea54c8927 SILPrintContext: support for printing consistent block numbers. 2017-04-05 19:59:15 -07:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
practicalswift
797b80765f [gardening] Use the correct base URL (https://swift.org) in references to the Swift website
Remove all references to the old non-TLS enabled base URL (http://swift.org)
2016-11-20 17:36:03 +01:00
practicalswift
a942bb76d0 [gardening] Fix formatting of recently introduced headers. 2016-03-19 00:37:37 +01:00
Erik Eckstein
8f78085e8b Refactor SILPrinter.
Introduce a new SILPrintContext class which is the main handle passed to the SILModule's and SILFunction's print functions.
It also allows to let derived classes implement call backs on instruction printing.
NFC for now, but needed for the upcoming SIL-debuginfo change.
2016-03-18 14:01:38 -07:00