Skip to content
This repository was archived by the owner on Feb 5, 2019. It is now read-only.

PNaCl Transform Passes for Rust. #6

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
295 commits
Select commit Hold shift + click to select a range
6e7773b
PNaCl: Add ExpandByVal pass for expanding out by-value struct args an…
Apr 24, 2013
49e4c2d
Copy Bitwriter to generate PNaClBitwriter.
KarlSchimpf Apr 26, 2013
9bf5e84
Check for metadata in PNaCl ABI checker.
Apr 26, 2013
57aa43a
Fix CMake build of NaClBitWriter
dschuff Apr 26, 2013
be482d3
Use unique'ed types for varargs expansion instead of non-unique named…
Apr 29, 2013
2c85793
Remove unnecessary includes from pnacl-freeze.
KarlSchimpf Apr 30, 2013
509396e
Copy LLVM bitcode reader to generate a PNaCl wire format reader.
KarlSchimpf May 1, 2013
4a6e20e
Copy BitCodes.h to NaCl/NaClBitCodes.h
KarlSchimpf May 2, 2013
7d3f600
Allow pnacl-freeze/thaw to redirect to stdin/stdout.
KarlSchimpf May 6, 2013
adabcf3
Copy llvm-bcanalyzer to build pnacl-bcanalyzer.
KarlSchimpf May 6, 2013
39f22bb
Start a whitelist of intrinsics for the PNaCl ABI checker.
May 7, 2013
e40bd3d
Insert denominator zero checks for NaCl
May 8, 2013
df069b9
Put llvm.powi in the dev list of intrinsics.
May 8, 2013
3ab32c5
PNaCl: Add NoAlias attributes in ExpandByVal and ExpandVarArgs passes
May 9, 2013
747c5fa
Move llvm.eh.frame.cfa to the blacklist of intrinsics.
May 9, 2013
9721e35
PNaCl ABI: Promote illegal integer types
dschuff May 11, 2013
a41d5a7
Start to disallow llvm.frameaddress and llvm.returnaddress in ABI che…
May 14, 2013
be88b44
Update PNaCl intrinsic whitelist test for moving {frame,return}addres…
May 14, 2013
c9d8296
Adding a pass - RewritePNaClLibraryCalls, that replaces known library…
eliben May 14, 2013
6a843cb
Fix some build warnings in Nacl-specific code
eliben May 14, 2013
8e9cf52
The customary LLVM way of obtaining intrinsics is with
eliben May 14, 2013
1ae1b65
Update tests to use FileCheck instead of grep (which is deprecated in…
eliben May 14, 2013
ead22ba
Temporarily remove test that fails on Mac
eliben May 16, 2013
0a91dd1
PNaCl: Fix FlattenGlobals to correctly handle implicitly-aligned vari…
May 20, 2013
178bf41
Fix stderr redirection in test to work on all platforms
eliben May 20, 2013
458ac10
Create type IDs based on reference counts.
KarlSchimpf May 20, 2013
03347c9
PNaCl: Fix ExpandCtors to handle an empty list case
May 22, 2013
118efa1
PNaCl: Add ReplacePtrsWithInts pass for stripping out pointer types
May 22, 2013
aafd726
Promote bswap i16, i32, and i64 to be allowed llvm intrinsics.
May 22, 2013
0de113d
Make abbreviations explicit in pnacl-freeze/thaw.
KarlSchimpf May 24, 2013
16b953b
PNaCl: Fix ReplacePtrsWithInts to handle some corner cases correctly
May 24, 2013
d622ca0
PNaCl: Add pass to expand out Clang-generated umul.with.overflow calls
May 24, 2013
ce93fdb
PNaCl: Add "-pnacl-abi-simplify-{pre,post}opt" meta-passes to "opt"
May 25, 2013
6b0ee9f
PNaCl: Enable the ReplacePtrsWithInts pass
May 28, 2013
1fc4fe8
Add two passes that implement conversions from PNaCl's specific intri…
eliben May 28, 2013
6029006
PNaCl ABI checker: Disallow inline assembly
May 28, 2013
015c7e8
PNaCl: Extend ExpandMulWithOverflow pass to handle uadd.with.overflow…
May 28, 2013
7ea014a
Fix integer promotion pass to handle casts to struct pointer types.
dschuff May 28, 2013
e8317eb
Expess NaClTransforms' dependence on IPO in LLVMBuild instead of CMak…
dschuff May 28, 2013
696d4ae
PNaCl: Disable parts of InstCombine that introduce *.with.overflow in…
May 29, 2013
2ea338f
Enable integer promotion pass and enable ABI check for integer types.
dschuff May 29, 2013
8913fbd
Fix PromoteIntegers pass to handle undef constants
dschuff May 29, 2013
6359e11
Revert "Enable integer promotion pass and enable ABI check for intege…
May 30, 2013
e57bb24
PNaCl: Add ExpandSmallArguments pass to widen parameters to 32 bits
May 30, 2013
d65ade8
PNaCl ABI checker: Reject integer arguments smaller than i32
May 30, 2013
535f663
Add switch support to integer promotion pass
dschuff May 30, 2013
4dbf224
Enable integer promotion pass and add ABI check for integer types
dschuff May 30, 2013
ba00c8a
PNaCl: Add a pass to expand out Clang's use of registers of struct type
May 30, 2013
5ee5ff5
PNaCl ABI checker: Disallow llvm.lifetime.start/end intrinsics
May 30, 2013
8bbadd9
PNaCl ABI checker: Disallow ExtractValue and InsertValue instructions
May 31, 2013
7e55b6b
PNaCl: Remove and disallow llvm.invariant.start/end intrinsics
May 31, 2013
8ea339a
PNaCl: FlattenGlobals: Use ptrtoint+add instead of getelementptr+bitcast
May 31, 2013
7fbc96e
PNaCl ABI checker: Require global variable initialisers to be flattened
May 31, 2013
3a55f56
Revert "PNaCl ABI checker: Disallow ExtractValue and InsertValue inst…
jfbastien Jun 3, 2013
6592bd8
PNaCl: ExpandVarArgs: Use memcpy() instead of struct load+store for s…
Jun 3, 2013
9604378
PNaCl: Fix ReplacePtrsWithInts so that ptrtoint always casts to i32
Jun 3, 2013
7b9abec
PNaCl ABI checker: Disallow ExtractValue and InsertValue instructions…
Jun 3, 2013
4b79db8
PNaCl gep expansion: avoid mul by 1 for i8 arrays.
Jun 3, 2013
0ff07d2
PNaCl ABI checker: Check for normal form introduced by ReplacePtrsWit…
Jun 4, 2013
1b53dd7
PNaCl ABI checker: Reject the "addrspace" attribute
Jun 4, 2013
b002fa1
PNaCl: Enable RewritePNaClLibraryCalls and fix it to remove unused decls
Jun 5, 2013
0d5660f
PNaCl ABI checker: Reject functions that are declared but not defined
Jun 5, 2013
189f7c6
PNaCl ABI: Strip out attributes on functions and function calls
Jun 5, 2013
0942dd5
Make PNaCl bitcode files have a different format from LLVM bitcode fi…
KarlSchimpf Jun 6, 2013
14a3b18
PNaCl ABI: Strip out calling conventions from functions and calls
Jun 6, 2013
376b6b1
PNaCl: Extend ExpandStructRegs to handle "insertvalue" instructions
Jun 10, 2013
3315913
Fix the ninja build by adding naclbitreader to dependencies.
Jun 10, 2013
3f13359
PNaCl ABI: Strip out arithmetic attributes "nsw", "nuw" and "exact"
Jun 12, 2013
da0cd84
Move non-Pow transcendentals back to disallowed list (unused).
Jun 12, 2013
42c86be
Move llvm.expect from dev to blacklist. Convert with -lower-expect.
Jun 13, 2013
b7f6e76
PNaCl: Fix new[]/delete mismatch in FlattenGlobals pass by using dele…
Jun 13, 2013
4300f03
Fix reading of headers when using a streamable memory object.
KarlSchimpf Jun 13, 2013
6ab4602
Insulate PNaCl bitcode from LLVM encodings of floating point optimiza…
KarlSchimpf Jun 13, 2013
0f9ee63
Remove unused function from PNaCl bitcode writer.
KarlSchimpf Jun 13, 2013
9df5d69
PNaCl: Strip more unwanted attributes: "align" on functions and "unna…
Jun 13, 2013
0caa04c
PNaCl ABI: Convert "private" linkage to "internal"
Jun 14, 2013
fac278e
PNaCl ABI: Disallow the "available_externally" linkage type
Jun 15, 2013
2c083ce
PNaCl ABI: Disallow non-default symbol visibility ("hidden" and "prot…
Jun 16, 2013
9e1af1c
PNaCl: Turn on ABI verifier by default in sandboxed translator
Jun 17, 2013
e5bdce6
Insulate calling conventions in PNaCl bitcode files.
KarlSchimpf Jun 19, 2013
9a8f36a
Rewrite llvm.flt.rounds to "1" for now, and disallow llvm.flt.rounds.
Jun 19, 2013
59bf6eb
PNaCl ABI: Disallow the "externally_initialized" attribute of GlobalV…
Jun 19, 2013
770b3a7
PNaCl ABI: Reduce the set of allowed "align" attributes on loads/stores
Jun 20, 2013
76c5527
Unbreak CMake+Ninja build
eliben Jun 20, 2013
9b6ee59
Fix warning messages in bitcode encoding functions.
KarlSchimpf Jun 21, 2013
e02aeaf
PNaCl wire format: Remove function attributes from pexe reader/writer
Jun 21, 2013
165f946
Update LangRef.rst to the 3.3 version and add PnaclRef.rst
eliben Jun 21, 2013
339f749
PNaCl wire format: Remove the top-level TRIPLE record
Jun 24, 2013
68fd598
Simplify representation of forward value references in bitcode.
KarlSchimpf Jun 24, 2013
dde6e28
Move i32/i64 cttz, ctlz, and ctpop to whitelisted intrinsics.
Jun 24, 2013
694a1ea
PNaCl ABI: Disallow built-in multiplication in "alloca" instructions
Jun 24, 2013
a43b9ab
PNaCl ABI: Strip alignment info from memcpy/memmove/memset intrinsic …
Jun 25, 2013
a082a8b
Clarify PNaClLangRef w.r.t. function attributes or varargs
eliben Jun 25, 2013
f4ee08b
PNaCl ABI: Disallow various operations on the i1 type
Jun 25, 2013
05cfe59
PNaCl: Fix removal of dead function prototypes in ABI simplification
Jun 25, 2013
3ac3935
PNaCl: Fix ExpandStructRegs to handle "select" instructions
Jun 25, 2013
73a2452
PNaCl wire format: Remove the top-level DATALAYOUT record
Jun 25, 2013
232f9d4
Support for mem* library functions in stable bitcode via intrinsics.
eliben Jun 25, 2013
8521ee8
PNaCl wire format: Remove code for reading old SwitchInst representation
Jun 26, 2013
edd0cbd
PNaCl wire format: Remove magic number and hash from encoding of 'swi…
Jun 26, 2013
2a6f8e8
PNaCl wire format: Clean up representation of "alloca" instruction
Jun 26, 2013
cf4f940
PNaCl wire format: Use FORWARDTYPEREF consistently for all forward re…
Jun 26, 2013
4fe7030
PNaCl wire format: Remove the METADATA_BLOCK block from pexes
Jun 26, 2013
3c307f9
PNaCl wire format: Disallow duplicate FORWARDTYPEREFs for the same va…
Jun 26, 2013
266ded2
PNaCl pexe reader: Remove now-unused Type argument from getValue()/po…
Jun 26, 2013
bcdc0be
Move stacksave/restore to allowed list, pow to disallowed.
Jun 28, 2013
6244024
PNaCl ABI: Remove use of @llvm.memset.p0i8.i64 (64-bit intrinsic vari…
Jun 30, 2013
cbd0615
PNaCl ABI checker: Check for exact names and types of whitelisted int…
Jul 1, 2013
5f39316
Internalize all symbols except _start.
eliben Jul 1, 2013
cc76d86
Enable ABI verification check for whitelisting external symbols
eliben Jul 2, 2013
7a646bb
Tweak the PNaClLangRef doc with some recent changes
eliben Jul 2, 2013
c5b2bfe
Simplify globals in PNaCl wire format based on normalized constants.
KarlSchimpf Jul 2, 2013
0818232
Move LLVM sqrt intrinsic to stable (for float and doubles).
Jul 2, 2013
6878dc2
Cleanup output of pnacl-bcanalyzer.
KarlSchimpf Jul 3, 2013
72449d3
Don't generate Type ID's for global variable fields.
KarlSchimpf Jul 3, 2013
b74087e
Do not fail when library functions are declared incorrectly.
eliben Jul 3, 2013
1483b38
Add option to pnacl-abicheck to handle pnacl bitcode
dschuff Jul 10, 2013
bc8ef24
Reject the llvm.powi intrinsic in the PNaCl ABI verifier.
eliben Jul 10, 2013
536ab9c
Concurrency support for PNaCl ABI
jfbastien Jul 13, 2013
c18c9be
Make it compile
eliben Jul 16, 2013
9545990
Remove useless field InstructionList from NaClBitcodeReader.
KarlSchimpf Jul 16, 2013
f2f8a7c
Adding checks for isEnumAttribute because getKindAsEnum now asserts
eliben Jul 18, 2013
f151cfa
More safeguarding of Attr->getKindAsEnum by checking for isEnumAttribute
eliben Jul 18, 2013
8e0f7fd
Remove prefetch
jfbastien Jul 21, 2013
b28369d
Disallow dev/private intrinsics by default (only llvm.nacl.target.arc…
Jul 22, 2013
5efda18
Remove module info records not allowed by PNaCl from the bitcode.
KarlSchimpf Jul 22, 2013
1488f2d
Fix default cases for printing instructions/constants in PNaCl wire f…
KarlSchimpf Jul 22, 2013
5661bc7
Enable ability to have multiple PNaCl wire format versions.
KarlSchimpf Jul 22, 2013
ea24796
Remove constant expressions and constant inline assembly from the PNaCl
KarlSchimpf Jul 25, 2013
051cc8c
Remove dead instructions from the PNaCl bitcode reader/writer:
KarlSchimpf Jul 25, 2013
5060126
Remove block address constants form PNaCl bitcode.
KarlSchimpf Jul 25, 2013
dba1f15
Remove handling of nongenerable instructions in PNaCl reader.
KarlSchimpf Jul 29, 2013
e4633e6
Updating the PNaCl reference manual to be in line with ABI verifier
eliben Jul 29, 2013
6e46198
Fix formatting and remove TODO in PNaClLangRef.rst
eliben Jul 29, 2013
1f4f75d
Beginnings of a "PNaCl Developer's Guide".
eliben Jul 29, 2013
3b545c5
Describe NaCl-specific intrinsics.
eliben Jul 30, 2013
3cc7756
Clarify that externally_initialized is not supported.
eliben Jul 30, 2013
f459d5e
Move alloca into subsection for better formatting.
eliben Jul 30, 2013
cda4a1d
Rewrite ``asm("":::"memory")`` to ``fence seq_cst``
jfbastien Jul 30, 2013
95a52d5
Remove the inttoptr dependency from load instructions.
KarlSchimpf Aug 1, 2013
364f0b7
Add Intrinsic::nacl_atomic_is_lock_free
jfbastien Aug 1, 2013
00d7085
Remove the bitcast (of global values) from load instructions.
KarlSchimpf Aug 2, 2013
294763f
Add missing include to ResolvePNaClIntrinsics.cpp
jfbastien Aug 2, 2013
005fbb3
Remove duplicate 'we' in comment.
KarlSchimpf Aug 2, 2013
fdce2dd
Remove unnecessary pointer casts on store instructions.
KarlSchimpf Aug 2, 2013
e7ef1f7
Fix handling of the volatile bit of loads/stores in PNaCl bitcode files.
KarlSchimpf Aug 5, 2013
87c789f
Rework PNaCl memory ordering
jfbastien Aug 6, 2013
a0343d2
Add the new @llvm.nacl.atomic.fence.all intrinsic
jfbastien Aug 7, 2013
0b49871
Add simple dead code elimination at the end of post-opt.
jfbastien Aug 9, 2013
47063f2
Properly support 16-bit atomics on x86-32.
jfbastien Aug 10, 2013
63ebc51
Add NaClBitReader library dependencies to pnacl-freeze.
KarlSchimpf Aug 13, 2013
ef2d144
Allow record-level printing by pnacl-bcanalyzer.
KarlSchimpf Aug 14, 2013
9a7dd5f
Updating the developer's guide with additional PNaCl information.
eliben Aug 14, 2013
ce42501
Correct DCE comment.
jfbastien Aug 14, 2013
31bd9d3
Remove ptrtoint instructions from the PNaCl bitcode file.
KarlSchimpf Aug 14, 2013
ed2f2e6
PNaCl bitcode: Remove support for string constant values
Aug 23, 2013
cbb77d6
PNaCl bitcode: Remove support for TYPE_CODE_FUNCTION_OLD
Aug 23, 2013
0acf146
Elide pointer to int casts on phi nodes.
KarlSchimpf Aug 26, 2013
b00ef98
PNaCl bitcode: Remove definition of unused constant, SWITCH_INST_MAGIC
Aug 28, 2013
a2b0991
Handle pointer conversions for call instructions.
KarlSchimpf Aug 28, 2013
e78b0a1
PNaCl bitcode: Remove support for >64-bit int constants (CST_CODE_WID…
Aug 29, 2013
9713e37
PNaCl bitcode: Remove handling of unsupported floating point types
Aug 29, 2013
8e8b1be
PNaCl bitcode: Remove handling of TYPE_CODE_OPAQUE
Aug 29, 2013
a39fe16
PNaCl bitcode: Remove handling of named struct types
Aug 29, 2013
1cc951a
Remove generating STRUCT_ANON records in PNaCl bitcode files.
KarlSchimpf Aug 30, 2013
3b76d50
Revert "Remove generating STRUCT_ANON records in PNaCl bitcode files."
KarlSchimpf Aug 30, 2013
8026892
PNaCl bitcode: Remove handling of USELIST blocks
Aug 31, 2013
fbb0826
Allow PNaCl bitcode versions to be automatically extendable.
KarlSchimpf Sep 3, 2013
df0ba95
Remove all remaining pointer casts from PNaCl bitcode files.
KarlSchimpf Sep 3, 2013
2827ff4
Remove generating STRUCT_ANON records in PNaCl bitcode files.
KarlSchimpf Sep 3, 2013
53a45c9
PNaCl bitcode reader: Disallow pointer-typed arguments in indirect calls
Sep 4, 2013
0683257
Remove ARRAY/VECTOR types from PNaCl bitcode files.
KarlSchimpf Sep 4, 2013
1963602
PNaCl bitcode: Don't output the LABEL type in the type table
Sep 5, 2013
8efd3ec
PNaCl bitcode: Indirect calls: Store return type instead of function …
Sep 5, 2013
8cc1e2c
PNaCl bitcode: Change test to use an intrinsic to make it more realistic
Sep 6, 2013
b706f4b
PNaCl bitcode: Fix some tests to not use unsupported pointer-typed args
Sep 6, 2013
2522824
Clean up vestigial code for constants in PNaCl bitcode files.
KarlSchimpf Sep 6, 2013
1e209b8
PNaCl bitcode: Strip pointer types from intrinsic declarations' param…
Sep 6, 2013
c0cf538
PNaCl bitcode: Use function type not ptr-to-function type to declare …
Sep 6, 2013
2e77d0e
PNaCl bitcode: Fix two compiler warnings about unused variables
Sep 6, 2013
c93d025
PNaCl bitcode: Change FORWARDTYPEREF to never use pointer types
Sep 9, 2013
7622ac6
PNaCl bitcode: Remove TYPE_CODE_POINTER entries from type table
Sep 9, 2013
c71c185
PNaCl bitcode: Fix reader to handle pointer type in is.lock.free intr…
Sep 9, 2013
e9178e4
Allow PNaCl version 2 to be supported and readabile.
KarlSchimpf Sep 9, 2013
1439644
PNaCl bitcode: Make the reader reject TYPE_CODE_POINTER in the type t…
Sep 9, 2013
97e3a7a
Report fatal translator errors to the browser
dschuff Sep 13, 2013
2d6610f
Generate PNaCl bitcode files using version 2.
KarlSchimpf Sep 16, 2013
b49c0f3
Only allow PNaCl version 2 bitcode files.
KarlSchimpf Sep 18, 2013
e329c33
Remove code referring to PNaCl version 1, since it is no longer used.
KarlSchimpf Sep 18, 2013
7f35d54
Support mul binary operator in integer promotion pass
dschuff Sep 20, 2013
7c680b7
Fix Ninja build of pnacl-freeze so that tests pass
Oct 2, 2013
628a3b2
PNaCl bitcode: Remove unused function ConvertTypeToScalarType()
Oct 3, 2013
a743832
PNaCl bitcode reader: Remove Xcode/ranlib-related hack
Oct 3, 2013
00d44e4
PNaCl bitcode: Reject CAST_PTRTOINT and CAST_INTTOPTR
Oct 3, 2013
cbad654
PNaCl bitcode: Simplify how the writer elides casts
Oct 3, 2013
0a19c56
[MIPS] Define PnaclTargetArchitectureMips_32
petar-jovanovic Oct 5, 2013
b8397a5
Fix bug in rewriting of library calls to intrinsics + new regression …
eliben Oct 11, 2013
182cf57
The PNaCl bitcode reference manual has moved into the Chromium reposi…
eliben Oct 14, 2013
9518f79
Add PNaClSjLjEH pass to implement C++ exception handling using setjmp…
Oct 16, 2013
592669b
Remove unused globals.
jfbastien Oct 21, 2013
0ab4624
Make sure flatten globals doesn't insert uses of globals that previou…
jfbastien Oct 22, 2013
0114715
Remove the PNaClDeveloperGuide doc from docs/ - it's now in the Chrom…
eliben Oct 24, 2013
abd7ba8
PNaCl: Add option to PNaClABISimplify for enabling the PNaClSjLjEH pass
Oct 29, 2013
1033f4e
Factor out bitcode parser from pnacl-bcanalyzer.
KarlSchimpf Nov 7, 2013
91a3623
Switch PromoteIntegers pass from clearing upper bits after converted …
dschuff Nov 15, 2013
b245866
Make integer promotion pass preserve debug info
dschuff Nov 15, 2013
39b6b4f
PNaCl: Change exception info format to distinguish catch-all/cleanup …
Nov 16, 2013
ad8948c
Remove UseRelativeID branching from NaClBitcodeReader, assume true.
Nov 20, 2013
97cb1e2
pnacl-benchmark - an ad-hoc tool to benchmark PNaCl translation-relat…
eliben Nov 21, 2013
aef82f0
Fixes the modeling of type ids within PNaCl bitcode files.
KarlSchimpf Nov 21, 2013
40b106c
Clean up handling of PNaCl bitcode headers.
KarlSchimpf Nov 21, 2013
da760b7
Fix bug in writing types for typecast instruction.
KarlSchimpf Nov 22, 2013
dec32d6
Split out PNaCl bitcode analysis into a library and use it in pnacl-b…
eliben Nov 25, 2013
3d9aeb9
Improve pnacl-benchmark's approximation of simple bitcode parsing.
eliben Nov 27, 2013
4e5a0e8
Clean up pnacl bcanalyzer library code.
KarlSchimpf Nov 27, 2013
02f9295
PNaCl: SJLJ EH: Fix incorrect use of setjmp()
Dec 2, 2013
c3b5f87
Remove the blob abbreviation in PNaCl bitcode files.
KarlSchimpf Dec 3, 2013
32d8342
Don't save 'nuw', 'nsw', and 'exact' attributes in PNaCl bitcode files.
KarlSchimpf Dec 3, 2013
a8bd5c3
Remove named abbreviations from PNaCl bitcode files.
KarlSchimpf Dec 3, 2013
7f84ee5
Neutralize PNaCl bitcode values for comparison conditions.
KarlSchimpf Dec 4, 2013
5c45dd0
Neutralize PNaCl bitcode reader for comparison conditions.
KarlSchimpf Dec 4, 2013
519871f
Ignore fast-mode flags in the PNaCl bitcode reader.
KarlSchimpf Dec 5, 2013
0bbbd5d
Fix header file to define symbols in namespace llvm.
KarlSchimpf Dec 5, 2013
ccc3f9b
Don't add fast-mode flags into PNaCl bitcode files.
KarlSchimpf Dec 6, 2013
ab64542
Create initial implementation of pnacl-bccompress.
KarlSchimpf Dec 12, 2013
e96595c
Adds notion of value distributions for PNaCl bitcode files.
KarlSchimpf Dec 13, 2013
b9ab446
Add CL argument -bitcode-format to llvm-dis, llc, and pnacl-llc.
KarlSchimpf Jun 7, 2013
4c417f6
Revert portions of 0a19c5623edeb7983754e80f5a052d895541a072.
Feb 25, 2014
0cf6a3d
Revert portions of 696d4ae2ba6998572628a4b7bc0aaa53343591df.
Feb 25, 2014
9bb7a13
Revert a portion of 6dc9d8a19d6c285ffd9fe86a479dbafbf21f65b0.
Feb 25, 2014
e146727
Revert a portion of c18c9bef0b863e16e96c0c2052908bcdfaf6719a.
Feb 26, 2014
0c2a024
Add the new tools to lit.cfg
Feb 26, 2014
32ecfcd
NaCl API renovations. Added a NaCl bc writing pass.
Feb 27, 2014
35cab3b
Typo fix.
Feb 27, 2014
5e940d9
Missing LINK_COMPONENTS for opt.
Feb 27, 2014
ec10d71
Fix switch instruction usage.
Feb 27, 2014
c463c6c
Revert portions of e40bd3de809b709efe4f47674546f8d63b65e54b.
Feb 27, 2014
612a0dc
Renovate NaCl bitcode reading && writing.
Feb 27, 2014
bb59b94
Disable overflow arithmetric in instcombine for NaCl targets.
Feb 27, 2014
58a397b
Revert part of 164c8e3910bc3628c047b9b34ab690394862ab76.
Feb 27, 2014
4560cef
Renovate NaCl transform tests.
Feb 27, 2014
fc7ef2a
Renovate PNaCl abi verifier tests.
Feb 27, 2014
1ff402f
Add missing headers; fix incorrect header paths.
Feb 27, 2014
a1fd9b9
Fix C++11 compatibility warning.
Feb 27, 2014
6fc8d0b
Switch to debug metadata.
Feb 27, 2014
ddae0a6
Add four new passes:
Feb 27, 2014
7558320
Add flag to PNaClABISimplifyAddPreOptPasses. Rust needs this to disab…
Feb 27, 2014
4e63c96
Add omitted attribute.
Feb 27, 2014
001d6b9
Rename building_lib -> BuildingLib.
Feb 27, 2014
1872ff4
Handle some nested structure use cases.
Feb 27, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions include/llvm/Analysis/NaCl.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
//===-- NaCl.h - NaCl Analysis ---------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_ANALYSIS_NACL_H
#define LLVM_ANALYSIS_NACL_H

#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include <string>

namespace llvm {

class FunctionPass;
class ModulePass;
extern cl::opt<bool> PNaClABIAllowDebugMetadata;

class PNaClABIErrorReporter {
public:
PNaClABIErrorReporter() : ErrorCount(0), Errors(ErrorString),
UseFatalErrors(true) {}
// Return the number of verification errors from the last run.
int getErrorCount() { return ErrorCount; }
// Print the error messages to O
void printErrors(llvm::raw_ostream &O) {
Errors.flush();
O << ErrorString;
}
// Increments the error count and returns an ostream to which the error
// message can be streamed.
raw_ostream &addError() {
ErrorCount++;
return Errors;
}
// Reset the error count and error messages.
void reset() {
ErrorCount = 0;
Errors.flush();
ErrorString.clear();
}
void setNonFatal() {
UseFatalErrors = false;
}
void checkForFatalErrors() {
if (UseFatalErrors && ErrorCount != 0) {
printErrors(errs());
report_fatal_error("PNaCl ABI verification failed");
}
}
private:
int ErrorCount;
std::string ErrorString;
raw_string_ostream Errors;
bool UseFatalErrors;
};

FunctionPass *createPNaClABIVerifyFunctionsPass(
PNaClABIErrorReporter *Reporter);
ModulePass *createPNaClABIVerifyModulePass(PNaClABIErrorReporter *Reporter,
bool StreamingMode = false);

}


#endif
270 changes: 270 additions & 0 deletions include/llvm/Bitcode/NaCl/NaClBitCodes.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,270 @@
//===- NaClBitCodes.h - Enum values for the bitcode format ------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This header Bitcode enum values.
//
// The enum values defined in this file should be considered permanent. If
// new features are added, they should have values added at the end of the
// respective lists.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_BITCODE_NACL_NACLBITCODES_H
#define LLVM_BITCODE_NACL_NACLBITCODES_H

#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/DataTypes.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MathExtras.h"
#include <cassert>

namespace llvm {
namespace naclbitc {
enum StandardWidths {
BlockIDWidth = 8, // We use VBR-8 for block IDs.
CodeLenWidth = 4, // Codelen are VBR-4.
BlockSizeWidth = 32 // BlockSize up to 2^32 32-bit words = 16GB per block.
};

// The standard abbrev namespace always has a way to exit a block, enter a
// nested block, define abbrevs, and define an unabbreviated record.
enum FixedAbbrevIDs {
END_BLOCK = 0, // Must be zero to guarantee termination for broken bitcode.
ENTER_SUBBLOCK = 1,

/// DEFINE_ABBREV - Defines an abbrev for the current block. It consists
/// of a vbr5 for # operand infos. Each operand info is emitted with a
/// single bit to indicate if it is a literal encoding. If so, the value is
/// emitted with a vbr8. If not, the encoding is emitted as 3 bits followed
/// by the info value as a vbr5 if needed.
DEFINE_ABBREV = 2,

// UNABBREV_RECORDs are emitted with a vbr6 for the record code, followed by
// a vbr6 for the # operands, followed by vbr6's for each operand.
UNABBREV_RECORD = 3,

// This is not a code, this is a marker for the first abbrev assignment.
// In addition, we assume up to two additional enumerated constants are
// added for each extension. These constants are:
//
// PREFIX_MAX_FIXED_ABBREV
// PREFIX_MAX_ABBREV
//
// PREFIX_MAX_ABBREV defines the maximal enumeration value used for
// the code selector of a block. If Both PREFIX_MAX_FIXED_ABBREV
// and PREFIX_MAX_ABBREV is defined, then PREFIX_MAX_FIXED_ABBREV
// defines the last code selector of the block that must be read using
// a single read (i.e. a FIXED read, or the first chunk of a VBR read.
FIRST_APPLICATION_ABBREV = 4,
// Defines default values for code length, if no additional selectors
// are added.
DEFAULT_MAX_ABBREV = FIRST_APPLICATION_ABBREV-1
};

/// StandardBlockIDs - All bitcode files can optionally include a BLOCKINFO
/// block, which contains metadata about other blocks in the file.
enum StandardBlockIDs {
/// BLOCKINFO_BLOCK is used to define metadata about blocks, for example,
/// standard abbrevs that should be available to all blocks of a specified
/// ID.
BLOCKINFO_BLOCK_ID = 0,

// Block IDs 1-7 are reserved for future expansion.
FIRST_APPLICATION_BLOCKID = 8
};

/// BlockInfoCodes - The blockinfo block contains metadata about user-defined
/// blocks.
enum BlockInfoCodes {
// DEFINE_ABBREV has magic semantics here, applying to the current SETBID'd
// block, instead of the BlockInfo block.

BLOCKINFO_CODE_SETBID = 1, // SETBID: [blockid#]
// The following two codes were removed
// because the PNaCl reader could read
// them, but couldn't be generated by
// the writer.
BLOCKINFO_CODE_BLOCKNAME = 2, // Not used in PNaCl.
BLOCKINFO_CODE_SETRECORDNAME = 3 // Not used in PNaCl.
};

} // End naclbitc namespace

/// NaClBitCodeAbbrevOp - This describes one or more operands in an abbreviation.
/// This is actually a union of two different things:
/// 1. It could be a literal integer value ("the operand is always 17").
/// 2. It could be an encoding specification ("this operand encoded like so").
///
class NaClBitCodeAbbrevOp {
uint64_t Val; // A literal value or data for an encoding.
bool IsLiteral : 1; // Indicate whether this is a literal value or not.
unsigned Enc : 3; // The encoding to use.
public:
enum Encoding {
Fixed = 1, // A fixed width field, Val specifies number of bits.
VBR = 2, // A VBR field where Val specifies the width of each chunk.
Array = 3, // A sequence of fields, next field species elt encoding.
Char6 = 4, // A 6-bit fixed field which maps to [a-zA-Z0-9._].
Blob = 5 // Not used in PNaCl. Used to be supported by the reader,
// but was never generated by the writer.
};

explicit NaClBitCodeAbbrevOp(uint64_t V) : Val(V), IsLiteral(true) {}
explicit NaClBitCodeAbbrevOp(Encoding E, uint64_t Data = 0)
: Val(Data), IsLiteral(false), Enc(E) {}

// For whatever reason, this isn't being autogenerated.
bool operator==(const NaClBitCodeAbbrevOp& rhs) const {
return Val == rhs.Val && IsLiteral == rhs.IsLiteral && Enc == rhs.Enc;
}

bool isLiteral() const { return IsLiteral; }
bool isEncoding() const { return !IsLiteral; }

// Accessors for literals.
uint64_t getLiteralValue() const { assert(isLiteral()); return Val; }

// Accessors for encoding info.
Encoding getEncoding() const { assert(isEncoding()); return (Encoding)Enc; }
uint64_t getEncodingData() const {
assert(isEncoding() && hasEncodingData());
return Val;
}

bool hasEncodingData() const { return hasEncodingData(getEncoding()); }
static bool hasEncodingData(Encoding E) {
switch (E) {
case Fixed:
case VBR:
return true;
case Array:
case Char6:
return false;
default:
break;
}
report_fatal_error("Invalid encoding");
}

/// isChar6 - Return true if this character is legal in the Char6 encoding.
static bool isChar6(char C) {
if (C >= 'a' && C <= 'z') return true;
if (C >= 'A' && C <= 'Z') return true;
if (C >= '0' && C <= '9') return true;
if (C == '.' || C == '_') return true;
return false;
}
static unsigned EncodeChar6(char C) {
if (C >= 'a' && C <= 'z') return C-'a';
if (C >= 'A' && C <= 'Z') return C-'A'+26;
if (C >= '0' && C <= '9') return C-'0'+26+26;
if (C == '.') return 62;
if (C == '_') return 63;
llvm_unreachable("Not a value Char6 character!");
}

static char DecodeChar6(unsigned V) {
assert((V & ~63) == 0 && "Not a Char6 encoded character!");
if (V < 26) return V+'a';
if (V < 26+26) return V-26+'A';
if (V < 26+26+10) return V-26-26+'0';
if (V == 62) return '.';
if (V == 63) return '_';
llvm_unreachable("Not a value Char6 character!");
}

};

template <> struct isPodLike<NaClBitCodeAbbrevOp> {
static const bool value=true;
};

/// NaClBitCodeAbbrev - This class represents an abbreviation record. An
/// abbreviation allows a complex record that has redundancy to be stored in a
/// specialized format instead of the fully-general, fully-vbr, format.
class NaClBitCodeAbbrev {
SmallVector<NaClBitCodeAbbrevOp, 8> OperandList;
unsigned char RefCount; // Number of things using this.
~NaClBitCodeAbbrev() {}
public:
NaClBitCodeAbbrev() : RefCount(1) {}

void addRef() { ++RefCount; }
void dropRef() { if (--RefCount == 0) delete this; }

unsigned getNumOperandInfos() const {
return static_cast<unsigned>(OperandList.size());
}
const NaClBitCodeAbbrevOp &getOperandInfo(unsigned N) const {
return OperandList[N];
}

void Add(const NaClBitCodeAbbrevOp &OpInfo) {
OperandList.push_back(OpInfo);
}
bool operator==(const NaClBitCodeAbbrev& rhs) const {
return OperandList == rhs.OperandList;
}
};

/// \brief Returns number of bits needed to encode
/// value for dense FIXED encoding.
inline unsigned NaClBitsNeededForValue(unsigned Value) {
// Note: Need to handle case where Value=0xFFFFFFFF as special case,
// since we can't add 1 to it.
if (Value >= 0x80000000) return 32;
return Log2_32_Ceil(Value+1);
}

/// \brief Encode a signed value by moving the sign to the LSB for dense
/// VBR encoding.
inline uint64_t NaClEncodeSignRotatedValue(int64_t V) {
return (V >= 0) ? (V << 1) : ((-V << 1) | 1);
}

/// \brief Decode a signed value stored with the sign bit in
/// the LSB for dense VBR encoding.
inline uint64_t NaClDecodeSignRotatedValue(uint64_t V) {
if ((V & 1) == 0)
return V >> 1;
if (V != 1)
return -(V >> 1);
// There is no such thing as -0 with integers. "-0" really means MININT.
return 1ULL << 63;
}

/// \brief This class determines whether a FIXED or VBR
/// abbreviation should be used for the selector, and the number of bits
/// needed to capture such selectors.
class NaClBitcodeSelectorAbbrev {

public:
// If true, use a FIXED abbreviation. Otherwise, use a VBR abbreviation.
bool IsFixed;
// Number of bits needed for selector.
unsigned NumBits;

// Creates a selector range for the given values.
NaClBitcodeSelectorAbbrev(bool IF, unsigned NB)
: IsFixed(IF), NumBits(NB) {}

// Creates a selector range when no abbreviations are defined.
NaClBitcodeSelectorAbbrev()
: IsFixed(true),
NumBits(NaClBitsNeededForValue(naclbitc::DEFAULT_MAX_ABBREV)) {}

// Creates a selector range to handle fixed abbrevations up to
// the specified value.
explicit NaClBitcodeSelectorAbbrev(unsigned MaxAbbrev)
: IsFixed(true),
NumBits(NaClBitsNeededForValue(MaxAbbrev)) {}
};
} // End llvm namespace

#endif
54 changes: 54 additions & 0 deletions include/llvm/Bitcode/NaCl/NaClBitcodeAnalyzer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
//===-- NaClBitcodeAnalyzer.h - Bitcode Analyzer --------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
// Analytical information about a bitcode file. Intended as an aid to developers
// of bitcode reading and writing software. It produces a summary of the bitcode
// file that shows various statistics about the contents of the file. By default
// this information is detailed and contains information about individual
// bitcode blocks and the functions in the module. The tool is also able to
// print a bitcode file in a straight forward text format that shows the
// containment and relationships of the information in the bitcode file (-dump
// option).
//
//===----------------------------------------------------------------------===//

#ifndef NACL_BITCODE_ANALYZER_H
#define NACL_BITCODE_ANALYZER_H

namespace llvm {

class MemoryBuffer;
class StringRef;
class raw_ostream;

// Analysis options. See the command-line documentation in pnacl-bcanalyzer
// for a description.
struct AnalysisDumpOptions {
AnalysisDumpOptions()
: DoDump(false), DumpOnlyRecords(false), OpsPerLine(0),
NoHistogram(false), NonSymbolic(false)
{}

bool DoDump;
bool DumpOnlyRecords;
unsigned OpsPerLine;
bool NoHistogram;
bool NonSymbolic;
};

/// Run analysis on the given file. Output goes to OS.
int AnalyzeBitcodeInFile(const StringRef &InputFilename, raw_ostream &OS,
const AnalysisDumpOptions &DumpOptions);

/// Run analysis on a memory buffer with bitcode. The buffer is owned by the
/// caller.
int AnalyzeBitcodeInBuffer(const MemoryBuffer &Buf, raw_ostream &OS,
const AnalysisDumpOptions &DumpOptions);

} // namespace llvm

#endif
Loading