Some cleanup of PCRE header

Summary: It seemed out of place for pcre_ functions to be declared in
program-functions.h.  Moved them to preg.h for documentation, and forward
declared them where necessary to keep dependencies minimal.

Reviewed By: @jdelong

Differential Revision: D1625249
Get tests passing with Simplifier turned off

Summary: Since we've lately discovered that Simplifier has some pretty
significant unsoundness, we wanted to see how much it costs us to turn
it off. First step is to pass tests with it turned off.

- The change to make bool-casting an array be accurate for
  NameValueTableWrapper wasn't applied to one callsite, which gets
  called by the translation of ConvCellToBool, which appears much more
  commonly when simplifier is off.

- The spec's description of CheckNullptr was wrong. This sent me on a
  wild goose chase for a bit.

- `AssertNonNull(nullptr)` appears in the IR with simplification off.
  This is OK because it's unreachable, but we need to give it a type
  that isn't Bottom and corresponds to a DataType, to avoid upsetting
  machinery downstream. (This definitely feels silly, but I tried a
  variety of other solutions and this is the simplest I found.)

- We start seeing `IsType<InitCell>`, which requires two comparisons to
  check. Just punt on it.

Reviewed By: @jdelong

Differential Revision: D1628088
Remove a couple of references to Eval.JitAStubsSize

Summary: This option was killed when we split astubs into cold and frozen.

Reviewed By: @bertmaher

Differential Revision: D1628118
Several changes to make simple tracelets pass with LLVM code gen.

Summary: Use HHVM_TC calling convention to gain access to %rbx, %r12, %rbp.

Workaround for non-SSA reserved registers.

Implementation for direct vcall/vinvoke instructions.

Substitution of pushm/ret combo with a tail call.

Fake personality function recognizable by LLVM runtime.

Emit set of instructions for minimal tracelets to pass.

Force no function alignment for emitted code.

Override stack alignment with 8 bytes.

Added a couple more optimization passes.

Create own MInstrState area and redirect %rsp-relative addresses to it.

Reviewed By: @swtaarrs

Differential Revision: D1616966
Emit uses of ZR intelligently on ARM

Summary: I added this to the immediate-folding pass. It seemed like most of the
unfortunate zero constants came from stores (e.g. in SpillFrame) so I've
added those for now.

In the process of doing this, I found a couple places where we were
emitting "add x0, x0, #0x0" which is totally useless, so I eliminated
those.

I eliminated all mention of zr from code-gen-arm.cpp, since we should
just make this pass handle all of it.

Reviewed By: @edwinsmith

Differential Revision: D1629590
Enable PGO for all functions

Summary: In server mode, only functions marked as hot were target of PGO.
This diff enables PGO for all functions.

Reviewed By: @jdelong

Differential Revision: D1623210
Convert most fssa() instructions to make call-target decisions at codegen time

Summary: We've had a long-standing issue since we do the indexing in the
optables at translation time, which means that changes (refinments) in the
instruction arg types in later optimization passes can break things.  This came
up again recently (and hopefully will come up more in the future), so let's fix
it.  For most cases this just moves the optable indexing to codegen time---but
there's were also a decent number of opcodes that used fssa() for no apparent
reason (or in some cases used optabs just to handle a bool, which seems a bit
excessive), so those were just converted into if statements or normal
native-calls on case-by-case basis.

Reviewed By: @swtaarrs

Differential Revision: D1625316
Remove fssa() support from native-calls.cpp

Reviewed By: @swtaarrs

Differential Revision: D1625331
Don't pass context class to minstr instructions as a constant SSATmp

Summary: I think back in the day we thought we might need these dependencies
explicit in the IR for inlining purposes, but it turned out not to be
neccessary.  (The way markers ended up we can definitely figure out which
context an instruction thinks it needed to be in.)

Reviewed By: @swtaarrs

Differential Revision: D1625335
Use extra data to pass incdec and setop subops in minstrs

Summary: Compile-time metadata.

Reviewed By: @alexmalyshev

Differential Revision: D1625341
Remove AttrHPHPSpecific and Func::getFuncInfo

Summary: Unused stuff.

Reviewed By: @elgenie, @mxw, @markw65

Differential Revision: D1625532
Fix how the JIT handles magic property methods from subclasses

Summary: Require we know there are no such subclasses.

Reviewed By: @swtaarrs

Differential Revision: D1625545
Generate ir opcode table by extracting lines from ir.specification

Reviewed By: @jasone

Differential Revision: D1625678
Remove unused OptionSetter class from simplifier unit test

Summary: Not used anymore

Reviewed By: @oyamauchi

Differential Revision: D1627272
Move simplifyLdCls out of the simplifier

Summary: It doesn't really seem plausible that a non-constant class name
becomes constant after other optimization passes, and we usually make this kind
of decision in hhbc-translator right now.  (Also this opcode should be very
rare in prod mode.)

Reviewed By: @alexmalyshev

Differential Revision: D1627496
Fix a bug in HhbcTranslator::isPseudoMain

Summary: This shouldn't have to inspect live VM state, and it turns out doing
so is hiding a bug.  If you cause the JIT to compile a pseudo-main not in
global scope, then it won't use LdGbl even though we could invoke it at global
scope later.

Reviewed By: @alexmalyshev

Differential Revision: D1627410
Remove assertion in String::attach, and unused const String& overload

Summary: I don't understand why there is a version taking the smart pointer
itself (I can't imagine a use case that isn't a bug), and I don't see why we
should limit attach to static strings (it's just a general thing you might want
to do if you already have a reference).

Reviewed By: @bertmaher

Differential Revision: D1627929
Normalize Simplifier functions

Summary: Make them all take IRInstruction's so we can automate the dispatch
table, and have fewer places to edit when adding new ones (now 2 vs. 3).  This
diff shouldn't have any functional changes except fixing a smart-memory-leak in
simplifyConcatStrStr.  (I wanted to do this a long time ago but never got
around to it; figured I'd do it as part of auditing what these things do for t5394328)

Reviewed By: @alexmalyshev

Differential Revision: D1627941
Some cleanup during simplifier audit; fix one bug in xorTrueImpl

Summary: Some clean up while auditing simplifier instructions for #5394328.  It
looks like the only incorrect cases are the ones I've added TODO's to (all
comparison op related).  Conditional jump folding already explicitly handled
reference counted values (with a comment explaining this exact case---blames
back to the original code).  The only functional change in this diff is to fix
a bug in xorTrueImpl for ColIsEmpty and ColIsNEmpty.

Reviewed By: @alexmalyshev

Differential Revision: D1630229
Fix remaining simplifier bug; try to add some validation assertions

Summary: This turned out to be way less of a general problem than we were
worried.  Almost all the simplifier rules just do constant folding or try to
eliminate no-op opcodes.  Only two were doing this wrong, both in the
not-folding stuff (other one is fixed in previous diff).  I audited all the
cmpImpl code and turns out to be fine.

This diff tries to add an assertion pass (which at least should document the
rules), but it's a little hokey for our stack opcodes: they need to be
special-cased because the simplifier can't easily double-check that the values
are known to be available due to being on the eval stack, but we know this is
true (in part because of bytecode invariants).  The requirements for those guys
to be correct is a little indirect (partially follows from our rules about
StkPtr use)---maybe I should add some documentation about it?

Reviewed By: @alexmalyshev

Differential Revision: D1630802