Age | Commit message (Collapse) | Author |
|
Write out all of PNaCl bitcode headers using a single interface
function.
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3720
R=jvoung@chromium.org
Review URL: https://codereview.chromium.org/61753017
|
|
The code previously was very inconsisted in modeling the number of
bits needed for type ids within abbreviations. Frequently, the
number of bits used was based on the total number of types. This
is a bad choice in that this includes all function types, even though
most cases do not use these types. This patch makes the selection
more consistent.
Also removing TYPE_CODE_ARRAY, since it is not allowed.
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3720
R=jvoung@chromium.org
Review URL: https://codereview.chromium.org/68503018
|
|
This was kept in upstream LLVM for backwards compatibiilty
with version 0 bitcode, but PNaCl only accepts version 1
bitcode, so UseRelativeID is always true.
This reduces the number of branches taken while llvm-dis'ing
the Ogre SampleBrowser from 2,680,184,988 branches to
2,670,798,955 branches. A 2.5% difference in wall-clock
time...
BUG=none
trybots:
http://chromegw.corp.google.com/i/tryserver.nacl/builders/nacl-toolchain-linux-pnacl-x86_32/builds/939
http://chromegw.corp.google.com/i/tryserver.nacl/builders/nacl-toolchain-linux-pnacl-x86_64/builds/991
http://chromegw.corp.google.com/i/tryserver.nacl/builders/nacl-toolchain-mac-pnacl-x86_32/builds/933
R=mseaborn@chromium.org
Review URL: https://codereview.chromium.org/77023007
|
|
Factors out bitcode parser from pnacl-bcanalyzer, so that it can also
be used for PNaCl bitcode to bitcode rewriters.
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3720
R=jvoung@chromium.org
Review URL: https://codereview.chromium.org/48623003
|
|
The PNaCl bitcode writer had some complex logic for deciding when to
omit casts in the output. This was left over from when the writer was
trying to leave in the casts in some but not all cases (as part of
incrementally removing casts).
This is no longer needed now that the writer just omits all inttoptrs,
all ptrtoints, and all pointer bitcasts.
This cleanup also fixes the writer so that it elides an inttoptr of a
ptrtoint. This sequence is allowed by the PNaCl ABI verifier, but
never occurred in practice because ReplacePtrsWithInts'
SimplifyCasts() function converts this sequence to an equivalent
bitcast. Before this change, the writer would give this error for an
inttoptr-of-ptrtoint:
LLVM ERROR: Illegal (PNaCl ABI) pointer cast : %1 = ptrtoint [4 x i8]* @bytes to i32
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3590
TEST=toolchain trybots
Review URL: https://codereview.chromium.org/25817002
|
|
Make the reader and writer stricter so that we can be sure we're not
accidentally generating ptrtoint or inttoptr instructions in pexe
files.
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3590
TEST=toolchain trybots
Review URL: https://codereview.chromium.org/25607006
|
|
This is a very Mac OS X-specific hack which isn't relevant to PNaCl.
PNaCl doesn't use Xcode's ranlib for processing bitcode libraries.
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3590
TEST=toolchain trybots
Review URL: https://codereview.chromium.org/25635004
|
|
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3590
TEST=build
Review URL: https://codereview.chromium.org/25802002
|
|
Declare NaClBitWriter's dependency on NaClBitReader.
Without this change, pnacl-freeze fails at run time with:
pnacl-freeze: symbol lookup error: .../native_client/pnacl/build/llvm_x86_64_ninja/lib/libLLVMNaClBitWriter.so: undefined symbol: _ZN4llvm17NaClBitcodeHeaderC1Ev
BUG=none
TEST=llvm-lit tests
Review URL: https://codereview.chromium.org/24524003
|
|
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3590
R=mseaborn@chromium.org
Review URL: https://codereview.chromium.org/24232002
|
|
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3590
R=jvoung@chromium.org
Review URL: https://codereview.chromium.org/23503071
|
|
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3590
R=mseaborn@chromium.org
Review URL: https://codereview.chromium.org/23974004
|
|
Install a fatal error handler for the translator, which stores the error
string, signals an error to the RPC thread, and terminates the thread
(instead of terminating the whole program). This will cause the error to
go to the Javascript console in Chrome
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3519
R=jvoung@chromium.org
Review URL: https://codereview.chromium.org/23753003
|
|
Only the bitcode linker via gold / lto module cares about
le32 being a target w/ a real backend.
LTOModule/LTOCodeGenerator is interested in having a real
target to know the name mangling and assembly notation
conventions (e.g., what's the prefix for private symbols).
This removes the hack from the bitcode reader so that
tools like llvm-dis are not affected and nonfinal pexes can
still say that they are "le32".
This is still not pretty, but it's better than polluting
the BitcodeReader, especially if certain tools check
what llvm-dis returns, and this doesn't require making a
dummy backend just for name mangling and asm conventions.
BUG=https://code.google.com/p/nativeclient/issues/detail?id=2554
TEST= trybots
http://chromegw.corp.google.com/i/tryserver.nacl/builders/nacl-toolchain-linux-pnacl-x86_32/builds/826
http://chromegw.corp.google.com/i/tryserver.nacl/builders/nacl-toolchain-mac-pnacl-x86_32/builds/830
http://chromegw.corp.google.com/i/tryserver.nacl/builders/nacl-toolchain-linux-pnacl-x86_64/builds/876
R=dschuff@chromium.org
Review URL: https://codereview.chromium.org/23619038
|
|
Making the reader stricter is something I forgot to do in my earlier
change that stops the writer from emitting TYPE_CODE_POINTER.
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3671
TEST=test/NaCl/Bitcode/*.ll
Review URL: https://codereview.chromium.org/23658027
|
|
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3590
R=jvoung@chromium.org
Review URL: https://codereview.chromium.org/23924004
|
|
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3671
TEST=test/NaCl/Bitcode/*.ll
+ NaCl's toolchain_tests with bitcode v2 enabled
Review URL: https://codereview.chromium.org/23523041
|
|
There are now no uses of pointer type IDs in PNaCl bitcode, so we can
stop outputting pointer types into the type table.
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3671
TEST=test/NaCl/Bitcode/*.ll
Review URL: https://codereview.chromium.org/23600013
|
|
Before, FORWARDTYPEREFs used i8* type rather than i32 if they
referenced an "alloca" instruction.
Clean this up so that FORWARDTYPEREFs use i32 instead in this case.
Note that this means that a forward-referenced "alloca" can be used
via an ptrtoint+inttoptr, rather than a bitcast, but that's no
problem.
This is a step towards removing TYPE_CODE_POINTER from the types
table, to simplify the PNaCl bitcode format.
Rename NormalizeParamType() to NormalizeScalarType() to reflect that
it's used in more cases; make it public.
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3671
TEST=test/NaCl/Bitcode/*.ll
Review URL: https://codereview.chromium.org/23719016
|
|
BUG=none
TEST=compile
Review URL: https://codereview.chromium.org/23619020
|
|
This is a step towards removing TYPE_CODE_POINTER from the types
table. This will make the format simpler. It will also make bitcode
files a little smaller, because we won't need to use type IDs for
referring to pointer types.
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3671
TEST=test/NaCl/Bitcode/*.ll
Review URL: https://codereview.chromium.org/24049002
|
|
Change the writer to strip pointer types from intrinsics' argument and
return types, replacing them with i32. This simplifies the PNaCl
bitcode format so that pointer types don't need to be represented
here.
Change the reader to restore the pointer types so that the intrinsic
declarations pass the LLVM and PNaCl verifiers.
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3671
TEST=intrinsic tests in call-elide.ll
+ intrinsic-pointer-args.ll
+ run small_tests with bitcode v2 enabled
Review URL: https://codereview.chromium.org/23793005
|
|
* Removes code that is no longer used because global variables are handled
separately.
* Removes CST_CODE_NULL.
* Adds special abbreviations for constant integer 0, replacing
most of what was lost when CST_CODE_NULL is removed.
* Adds abbreviation for floating point constants.
* Removes CST_CODE_AGGREGATE and CST_CODE_DATA, except for reading
old PNaCl version 1 bitcode files.
* Removes call to ParseConstants() in ParseModule() since the module
block no longer contains a constants block (globals are handled
separately).
* Removes getConstantFwdRef() method, since it is no longer needed.
* Remove ConstantPlaceHolder class, since it is no longer needed.
* Remove ResolvedConstants and ResolveConstantForwardRefs()
from the bitcode reader, since it is no longer needed.
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3668
R=mseaborn@chromium.org
Review URL: https://codereview.chromium.org/23522024
|
|
For indirect call instructions (INST_CALL_INDIRECT), it's not
necessary to store the full function type. The argument types are
already known from the arguments in the instruction. We only need to
store the return type to be able to reconstruct the full function
type.
Storing only the return type ID will make the bitcode a little more
compact. Return type IDs will be frequently-used scalar types, which
can be given smaller type IDs than function types, which are less
frequently used.
This potentially makes the writer simpler: In principle, the writer no
longer needs to make a pass across all functions' bodies to determine
which function types are used in order to build the type table.
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3544
TEST=*.ll tests
Review URL: https://codereview.chromium.org/23521005
|
|
The type ID for the "label" type is never referenced.
The "label" type was only being added to the type table because
EnumerateType() treats BasicBlock and Value operands the same.
However, the rest of the reader and writer treat BasicBlock operands
specially and not like other Values.
Change some tests to use wildcards for some type IDs. This is so that
I don't have to update all the type ID numbers now that the generated
type tables have changed.
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3590
TEST=run small_tests with v2 bitcode format enabled
Review URL: https://codereview.chromium.org/23530031
|
|
The value selector list for switch statements are represented using
ARRAY/VECTOR constants, but this information is not put into the bitcode file.
This CL changes the value enumerator to not emit these constants.
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3649
R=mseaborn@chromium.org
Review URL: https://codereview.chromium.org/23653013
|
|
Make the bitcode reader stricter, so that it disallows pointer
arguments in indirect function calls, which are disallowed by the
PNaCl ABI checker. Pointer arguments in function calls are only
allowed in intrinsic calls, and calls to intrinsics must always be
direct calls, not indirect calls.
This involves removing two tests that specifically test for pointer
args.
This is in preparation for tweaking how indirect calls are
represented, so that they store the call's return type rather than the
function type.
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3544
TEST=*.ll tests
Review URL: https://codereview.chromium.org/23660005
|
|
Don't generate types for elided cast instructions, since they
are never put into the bitcode file. In addition, do not generate
a type id for the types of global variables, because they are never
needed. Don't allow STRUCT_ANON in bitcode files PNaClVersion==2.
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3648
R=jvoung@chromium.org
Review URL: https://codereview.chromium.org/23455023
|
|
For PNaClVersion==2, removes remaining pointer casts from bitcode files.
This includes:
* Return value can be casted to a scalar value.
* Intrinsic calls may return an inherent pointer, which may
need casting to a scalar value.
Also modifies tests bitcast-elide.ll and inttoptr-elide.ll
by removing tests that assumed there were remaining pointer
bitcasts that do not get removed.
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3544
R=jvoung@chromium.org
Review URL: https://codereview.chromium.org/23524003
|
|
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3656
R=mseaborn@chromium.org
Review URL: https://codereview.chromium.org/23496022
|
|
These blocks are never generated by the PNaCl bitcode writer. The
code for generating them was removed when BitcodeWriter.cpp was copied
to produce NaClBitcodeWriter.cpp in
5712db994c8a4abb8c2512fb2900650f8335af66. The same wasn't done when
BitcodeReader.cpp was copied to produce NaClBitcodeReader.cpp, so we
do this now.
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3590
TEST=PNaCl toolchain trybots
Review URL: https://codereview.chromium.org/23598005
|
|
This reverts commit 2302e5d39e2302962d1a0e45d60e00ed47b9b061.
BUG=
R=eliben@chromium.org
Review URL: https://codereview.chromium.org/23827002
|
|
Don't generate types for elided cast instructions, since they
are never put into the bitcode file. In addition, do not generate
a type id for the types of global variables, because they are never
needed. Don't allow and STRUCT records in bitcode files
when PNaClVersion==2.
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3648
R=mseaborn@chromium.org
Review URL: https://codereview.chromium.org/23431008
|
|
Named struct types should not appear in LLVM IR that passes the PNaCl
ABI verifier.
Remove the test struct-types.ll because it no longer passes.
Handling of TYPE_CODE_STRUCT_ANON must remain for now until this issue
is fixed: https://code.google.com/p/nativeclient/issues/detail?id=3648
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3590
TEST=PNaCl toolchain trybots
Review URL: https://codereview.chromium.org/23490018
|
|
Opaque struct types should not appear in LLVM IR that passes the PNaCl
ABI verifier.
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3590
TEST=PNaCl toolchain trybots
Review URL: https://codereview.chromium.org/23738002
|
|
The only FP types that PNaCl currently supports are float and double.
Clean up error reporting:
* Convert an assert() to a report_fatal_error().
* Return an error rather than an "undef" value.
* Report the type code value when it is unknown.
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3590
TEST=PNaCl toolchain trybots
Review URL: https://codereview.chromium.org/23191009
|
|
The PNaCl ABI verifier does not allow large integer constants.
Remove an argument from EmitAPInt() which is now no longer used.
Also make error reporting for unknown Constants more verbose.
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3590
TEST=PNaCl toolchain trybots
Review URL: https://codereview.chromium.org/22903044
|
|
This also should complete the changes associated with removing pointer cast
instructions from the PNaCl bitcode file.
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3544
R=dschuff@chromium.org, jvoung@chromium.org
Review URL: https://codereview.chromium.org/23482002
|
|
This is unused since I cleaned up the handling of SwitchInsts for PNaCl.
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3590
TEST=PNaCl toolchain trybots
Review URL: https://codereview.chromium.org/23104008
|
|
Handles the eliding of pointer to integer casts operands of the phi node.
Also caches unelided casts generated in the reader (removing
duplicates within the same block). This reduces the size of
thawed pnacl-llc.pexe by about 2%.
BUG= https://code.google.com/p/nativeclient/issues/detailid=3544
R=mseaborn@chromium.org
Review URL: https://codereview.chromium.org/22909016
|
|
PNaCl uses TYPE_CODE_FUNCTION instead, as you'd expect.
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3590
TEST=PNaCl toolchain trybots
Review URL: https://codereview.chromium.org/22819015
|
|
These are no longer used since we introduced the GLOBALVAR block for
PNaCl, in which global variable initialisers are flattened.
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3590
TEST=PNaCl toolchain trybots
Review URL: https://codereview.chromium.org/22903045
|
|
Removes ptrtoint instructions when applicable (currently only in stores), and add them back just before their use.
Note: This code does not handle ptrtoint casts for calls and phi nodes, binary operators, etc. because handling of casts for these instructions has not been added yet.
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3544
R=jvoung@chromium.org
Review URL: https://codereview.chromium.org/22633002
|
|
Fixes so that the volatile bit is no longer put into the bitcode file,
since the volatile bit is not in the PNaCl ABI.
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3610
R=jvoung@chromium.org
Review URL: https://codereview.chromium.org/21949006
|
|
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3544
R=mseaborn@chromium.org
Review URL: https://codereview.chromium.org/21964002
|
|
Adds the eliding of bitcasts that are used as an argument to
instructions that expect normalized pointers. Currently, the checked
in code only checks normalized pointers for load instructions. Hence,
the restriction to load instructions. As more instructions are
modified to check for normalized pointers, this code will apply
to those instructions.
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3544
R=mseaborn@chromium.org
Review URL: https://codereview.chromium.org/21614002
|
|
Elides inttoptr casts used (exclusively) in load instructions when
PNaClVersion=2. This is an incremental start on removing the inttoptr
instruction from the PNaCl wire format (See issue 3544 for more information
on the strategy of removing ptrtoint).
Also modifies PNaCl bitcode reader/writer to accept PNaClVersion=1 as supported,
and PNaClVersion=2 as unsupported but readable (allowing pnacl-freeze and
pnacl-thaw to work on such files).
Also allows command-line option --pnacl-version for setting PNaClVersion in the
PNaCl bitcode writer.
Also fixes some problems on PNaCl bitcode headers, using common support to
determine when the read/written PNaCl bitcode file is valid.
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3544
R=jvoung@chromium.org
Review URL: https://codereview.chromium.org/5812155903377408
|
|
The PNaCl bitcode writer doesn't generate certain forms of instructions that
the PNaCl bitcode writer accepts. Since these instructions do not get
generated, remove them from the bitcode reader.
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3590
R=jvoung@chromium.org
Review URL: https://codereview.chromium.org/20442002
|
|
Removes block address constants because they are not part of the PNaClABI.
Suggested in CL https://codereview.chromium.org/20172002
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3590
R=mseaborn@chromium.org
Review URL: https://codereview.chromium.org/20402002
|
|
VAArg
Invoke
GetElementPtr
LandingPad
Resume
IndirectBr
ExtractElement
InsertElement
ShuffleVector
ExtractValue
InsertValue
AtomicCmpXchg
AtomicRMW
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3590
R=mseaborn@chromium.org
Review URL: https://codereview.chromium.org/20124002
|