- 15 Jul, 2015 2 commits
-
-
Jan Voung authored
By factoring out legalizeUndef(), we can use the same logic in prelowerPhis which may help if we ever change the value used (though if we switch from zero-ing out regs to using uninitialized regs, it'll take more work -- e.g., can't return a 64-bit reg). For x86, use legalizeUndef where it's clear that the value is immediately fed to loOperand/hiOperand then another legalize() call. Otherwise, leave the general X = legalize(X); alone where the code is counting on that being the sole legalization. For x86 legalize(const64) is a pass-through, which can then be passed to loOperand/hiOperand nicely. However, for ARM, legalize(const64) may end up trying to copy the const64 to a register, but we don't have 64-bit registers. Instead do legalizeUndef(X) where x86 would have just done legalize(X). This happens to work because legalizeUndef doesn't try to copy to reg, and we immediately pass the result to loOperand/hiOperand() which then passes the result to a real legalization call. Add a few more undef tests. BUG= https://code.google.com/p/nativeclient/issues/detail?id=4076 R=stichnot@chromium.org Review URL: https://codereview.chromium.org/1233903002 .
-
Jim Stichnoth authored
Specifically, we were ending up with Encoded_Reg_xmm0=0 yet Encoded_Reg_xmm1=10, Encoded_Reg_xmm2=11, etc. It's a mystery as to why this wasn't triggering any failures with filetype!=asm. BUG= none R=jpp@chromium.org Review URL: https://codereview.chromium.org/1231973003.
-
- 13 Jul, 2015 1 commit
-
-
Jan Voung authored
Clang appears to be missing an include path to find bits/c++config.h so we were unable to compile the unsandboxed c++ based cross tests and link against the subzero unsandboxed ARM object files. Work around this for now by finding and including the missing path. Turn on a few ARM cross tests that should be working (mem_intrin and test_strengthreduce -- though the strength-reduction isn't done for ARM). The test_bitmanip still fails, because under Om1 we overflow the stack offset and need to materialize that offset with a register first. Update a few other references that still say x8632. BUG= https://code.google.com/p/nativeclient/issues/detail?id=4076 R=jpp@chromium.org, stichnot@chromium.org Review URL: https://codereview.chromium.org/1232183002 .
-
- 11 Jul, 2015 1 commit
-
-
John Porto authored
More tests will be added during the AssemblerX8664 (on a separate CL.) BUG= R=jvoung@chromium.org Review URL: https://codereview.chromium.org/1231903002.
-
- 10 Jul, 2015 1 commit
-
-
Reed Kotler authored
This changes the run-pnacl-sz script to be more consistent with the other targets. BUG=https://code.google.com/p/nativeclient/issues/detail?id=4167 R=jvoung@chromium.org Review URL: https://codereview.chromium.org/1232483003 . Patch from Reed Kotler <reed.kotler@imgtec.com>.
-
- 09 Jul, 2015 2 commits
-
-
Jan Voung authored
Lower stacksave/restore. Lower ctlz, cttz, bswap, and popcount. Popcount is just done with a helper call. Ctz can use the clz instruction after reversing the bits. We can only crosstest stacksave/restore for now which happens to be written in C for the C99 VLAs. The CXX crosstests I can't seem to compile with the arm-cross-g++ (missing headers), so I will check that later after resolving the cross compilation issue. BUG= https://code.google.com/p/nativeclient/issues/detail?id=4076 R=jpp@chromium.org Review URL: https://codereview.chromium.org/1222943003 .
-
Jan Voung authored
When compiling with DEBUG, there is a problem linking InstMIPS32. It overrides dump, but never defined that. Also, update the code for some recent changes. Namely, we no longer check ALLOW_DUMP but instead check BuildDefs::dump(). Also, the instruction dtors have been deleted. BUG= https://code.google.com/p/nativeclient/issues/detail?id=4167 R=kschimpf@google.com Review URL: https://codereview.chromium.org/1214863019 .
-
- 08 Jul, 2015 1 commit
-
-
Reed Kotler authored
BUG= https://code.google.com/p/nativeclient/issues/detail?id=4167 R=jvoung@chromium.org Review URL: https://codereview.chromium.org/1176133004 . Patch from Reed Kotler <reed.kotler@imgtec.com>.
-
- 07 Jul, 2015 1 commit
-
-
John Porto authored
This CL introduces the X86Inst templates. The previous implementation relied on template specialization which did not played nice with the new design. This required a lot of other boilerplate code (i.e., tons of new named constructors, one for each X86Inst.) This CL also moves X8632 code out of the X86Base{Impl}?.h files so that they are **almost** target agnostic. As we move to adding other X86 targets more methods will be moved to the target-specific trait class (e.g., call/ret/argument lowering.) BUG= https://code.google.com/p/nativeclient/issues/detail?id=4077 R=jvoung@chromium.org Review URL: https://codereview.chromium.org/1216933015.
-
- 06 Jul, 2015 3 commits
-
-
Andrew Scull authored
Accidentally resurrected during rebase when it shouldn't have been. BUG= R=jvoung@chromium.org Review URL: https://codereview.chromium.org/1217503011.
-
Andrew Scull authored
There were many // comment used to document classes, functions etc. but those are not picked up by doxygen which expects /// comments. This converts many comments from // to /// in order to improve the generated documentation. BUG= R=jvoung@chromium.org, kschimpf@google.com Review URL: https://codereview.chromium.org/1216963007.
-
Jan Voung authored
The original arithmetic lowering was introducing some unused mov instructions from legalization (e.g., the upper part of shift num bits -- which should be 0 anyway), and div helper calls don't actually use the legalized parameters (handled separately by lowerCall). These unused instructions cause the Om1 allocator to assert that LRBegin exists but LREnd does not. BUG= https://code.google.com/p/nativeclient/issues/detail?id=4076 R=kschimpf@google.com Review URL: https://codereview.chromium.org/1210073017.
-
- 30 Jun, 2015 6 commits
-
-
John Porto authored
As part of the refactoring moves the MachineTraits<TargetX8632> to a separate header. BUG= https://code.google.com/p/nativeclient/issues/detail?id=4077 R=jvoung@chromium.org Review URL: https://codereview.chromium.org/1216033004.
-
Karl Schimpf authored
Deals with fact that minimal builds generate simple "generic" error messages, rather than descriptive error messages. BUG=None R=stichnot@chromium.org Review URL: https://codereview.chromium.org/1209083005.
-
Jan Voung authored
BUG=none R=jpp@chromium.org, kschimpf@google.com Review URL: https://codereview.chromium.org/1219883003.
-
Jan Voung authored
ARM normally just returns 0 when dividing by 0 with the software and hw implementations, which is different from what X86 does. So, for NaCl, we've modified LLVM to trap by inserting explicit 0 checks. Uses -mattr=hwdiv-arm attribute to decide if 32-bit sdiv/udiv are supported. Also lower the unreachable-inst to a trap-inst, since we need a trap instruction for divide by 0 anyway. Misc: fix switch test under MINIMAL=1, since ARM requires allow_dump for filetype=asm. Random clang-format changes... TODO: check via cross tests BUG= https://code.google.com/p/nativeclient/issues/detail?id=4076 R=stichnot@chromium.org Review URL: https://codereview.chromium.org/1214693004.
-
Karl Schimpf authored
If the bitcode parser detects that the last block in the function is missing a terminator, generate an error message and insert a terminator instruction. BUG= https://code.google.com/p/nativeclient/issues/detail?id=4214 R=stichnot@chromium.org Review URL: https://codereview.chromium.org/1210013005.
-
Jan Voung authored
No bool-folding optimization, just the straightforward compare followed by mov and conditional mov. BUG= https://code.google.com/p/nativeclient/issues/detail?id=4076 R=stichnot@chromium.org Review URL: https://codereview.chromium.org/1211243005.
-
- 29 Jun, 2015 3 commits
-
-
Andrew Scull authored
A naive implementation of switch lowering using sequential tests for each of the cases. BUG= none TEST=switch-opt.ll R=jvoung@chromium.org Review URL: https://codereview.chromium.org/1213593002.
-
Andrew Scull authored
BUG=none R=jvoung@chromium.org, stichnot@chromium.org Review URL: https://codereview.chromium.org/1207823002.
-
John Porto authored
IceCfg::getAssembler() is a template that simply static_casts the CFG's assembler. This could potentially be problematic in the future, so we enabled the (relatively) cheap llvm dyn_cast operator for Assemblers. This CL also renames assembler_mips32.h to IceAssemblerMIPS32.h. BUG= R=stichnot@chromium.org Review URL: https://codereview.chromium.org/1211863004.
-
- 28 Jun, 2015 1 commit
-
-
Jim Stichnoth authored
It tests dump output and therefore requires allow_dump. BUG= https://code.google.com/p/nativeclient/issues/detail?id=4212 R=jvoung@chromium.org Review URL: https://codereview.chromium.org/1214043002.
-
- 27 Jun, 2015 1 commit
-
-
Jim Stichnoth authored
Uses pragmas when including problematic LLVM headers, so that clang doesn't warn about unused parameters -- a rampant problem in the LLVM code. This way, we can increase clang's pickiness on Subzero code, and also not drown in LLVM warnings. BUG= none R=jpp@chromium.org, jvoung@chromium.org Review URL: https://codereview.chromium.org/1217433002
-
- 26 Jun, 2015 4 commits
-
-
John Porto authored
Also fixes the X8664 Registers file. BUG= https://code.google.com/p/nativeclient/issues/detail?id=4077 R=kschimpf@google.com Review URL: https://codereview.chromium.org/1212393005.
-
John Porto authored
BUG= R=stichnot@chromium.org Review URL: https://codereview.chromium.org/1211103004.
-
Karl Schimpf authored
Fixes constructor InstBr when it is a conditional branch, and the true and false branches are the same. BUG= https://code.google.com/p/nativeclient/issues/detail?id=4212 R=jpp@chromium.org, stichnot@chromium.org Review URL: https://codereview.chromium.org/1215443002.
-
Qining Lu authored
PURPOSE: The purpose of function layout reordering is to defend against code-reuse attacks as the location of code blocks will be various among different binaries. The layout reordering for global variables and pooled constants can be considered as static data randomization. This is to stop memory corruption attacks by randomizing the locations of the static data. After function layout reordering, the order of function blocks in TEXT section will be randomized. Global variable reordering randomize the order of global variables, and pooled constant reordering randomize the order of pooled constants. Note the order of constant pools won’t be affected and all pooled constants will remain in their original constant pools. USAGE: -reorder-functions: bool type command line option, enables function layout shuffling in TEXT section. Note when -threads=0 is set, function reordering will be forced off. -reorder-functions-window-size: uint32 type command line option, specify the length of the shuffling queue. Note -reorder-functions-window-size=0 or 1 means no shuffling applied to functions. -reorder-global-variables: bool type command line option, enables global variables shuffling. -reorder-pooled-constants: bool type command line option, enables pooled constants shuffling. APPROACH: Randomization is introduced at the code emission time. We use a shuffling method to randomize the emission of function code, global variables and pooled constants. For function code emission, we also introduce “window size” as a parameter to control the size of the function holding buffer for shuffling. Window size 1 and 0 mean no shuffling applied, and a value higher than the number of translated functions means holding all the functions and shuffling them before emitting any of them. IMPLEMENTATION: Function reordering: GlobalContext::emitItems(): Call RandomShuffle() routine to shuffle a specific part of the Pending vector. Global variable reorder: GlobalContext::lowerGlobals(const IceString &SectionSuffix): Call RandomShuffle() routine upon declaration list: Globals. Pooled constant reordering: TargetDataX8632::emitConstantPool(GlobalContext *Ctx): Add call to RandomShuffle() to shuffle the constant pool to be emitted. This is for asm output. ELFObjectWriter::writeConstantPool(Type Tu): Add call to RandomShuffle() to shuffle the constant pool before emitting it. This is only for elf output. ISSUES: The initialization of global variables are emitted along with function code, all of them are considered as EmitterWorkItem. However, we do need to first emit global variables to keep the block profiling workflow untouched. To fulfill this, a “kind” check is added in the while loop of GlobalContext::emitItems(). The “if” statement at line 480 shows the workaround of this issue. BUG= R=jpp@chromium.org, jvoung@chromium.org, stichnot@chromium.org Review URL: https://codereview.chromium.org/1206723003.
-
- 25 Jun, 2015 2 commits
-
-
John Porto authored
This "include module header first" is part of the llvm style guide. This change exposes "broken" headers that were accessing undefined types, or even using types without forward declaring them. BUG= R=stichnot@chromium.org Review URL: https://codereview.chromium.org/1202253002.
-
Jim Stichnoth authored
Also fixes a set of warnings that only show up for the cmake build. BUG= none R=jpp@chromium.org Review URL: https://codereview.chromium.org/1208673003
-
- 24 Jun, 2015 3 commits
-
-
John Porto authored
It turns out that using using TargetLowering::<member> causes problems when compiling with g++. The problem was fixed by using Machine:: instead, where Machine is the template parameter. With name-dependent identifier, g++ does the right thing. BUG= None R=stichnot@chromium.org Review URL: https://codereview.chromium.org/1208663002.
-
Jim Stichnoth authored
Try to make most #ifdef'd code be compiled under all configurations, to catch code rot earlier. When #ifdef code is required, try to use it only to guard trivial code like "return;". BUG= none R=jpp@chromium.org Review URL: https://codereview.chromium.org/1197863003
-
Karl Schimpf authored
Jan correctly pointed out that this makefie definition was redundant since -lLLVMNaClBitTestUtils was already defined in LLVM_LIBS_LIST. Removing the definition and simplifying makefile. BUG=None R=jpp@chromium.org Review URL: https://codereview.chromium.org/1211593003.
-
- 23 Jun, 2015 4 commits
-
-
John Porto authored
Related changes: NaCl change: https://codereview.chromium.org/1201483005 LLVM change: https://codereview.chromium.org/1193843016 BUG= https://code.google.com/p/nativeclient/issues/detail?id=4077 R=stichnot@chromium.org Review URL: https://codereview.chromium.org/1199043006.
-
Jim Stichnoth authored
Emacs will try to execute .dir-locals.el whenever loading a file under the subzero directory. It sets local variables depending on the mode. Set the fill-column to 80 for c++-mode, c-mode, and python-mode. The main use is when using M-q to reformat multi-line comments. Disable tabs (use spaces instead) in c++-mode, c-mode, and python-mode. Set the tab-width to 2 spaces in python-mode. (The tab-width doesn't really matter in c++-mode or c-mode thanks to clang-format.) BUG= none R=kschimpf@google.com Review URL: https://codereview.chromium.org/1199133005
-
Karl Schimpf authored
Fixes how (very) large size entries in the TYPE_CODE_NUMENTRY is handled when reading bitcode. Makes sure that we con't call vector.resize() with too large a value (replacing an allocation exception with a parse error). Also tries to clean up type modeling of bitcode indices (references to values etc in the bitcode). Uses common type NaClBcIndexSize_t and NaClRelBcIndexSize_t (defined in nacl) to describe these (32-bit) values. Note: We use cast truncation of 64-bit values to NaClBcIndexSize_t and NaClRelBcIndexSize_t, since negative value indices are stored both as 32 and 64 bit values. The truncation cast handles this differences correctly (and efficiently). BUG= https://code.google.com/p/nativeclient/issues/detail?id=4195 R=stichnot@chromium.org Review URL: https://codereview.chromium.org/1182323011
-
John Porto authored
BUG= https://code.google.com/p/nativeclient/issues/detail?id=4077 R=stichnot@chromium.org Review URL: https://codereview.chromium.org/1202533003.
-
- 22 Jun, 2015 4 commits
-
-
Jim Stichnoth authored
Look for "() override {}" and "() final {}" patterns. Don't touch IceTargetLoweringX8632.* to spare a refactoring in progress. BUG= none R=jpp@chromium.org Review URL: https://codereview.chromium.org/1201023002 -
Karl Schimpf authored
BUG=None R=stichnot@chromium.org Review URL: https://codereview.chromium.org/1205463002
-
Karl Schimpf authored
This has been added to allow fuzzing to be applied to textual bitcode records. When built with make option TEXTUAL_BITCODE=1, the corresponding generated pnacl-sz will preprocess the input file (containing the textual form of bitcode records) and generate a corresponding data stream with the binary form. Note that the texual form of bitcode records is not LLVM assembly (i.e. .ll files). Rather, it is sequences of texual integers corresponding to bitcode records. Dependent on: https://codereview.chromium.org/1191393004 BUG= https://code.google.com/p/nativeclient/issues/detail?id=4169 R=stichnot@chromium.org Review URL: https://codereview.chromium.org/1190413004
-
Jim Stichnoth authored
Some recent ARM changes turned out to break the lit tests for the MINIMAL build. Two main issues: 1. ARM tests are currently asm-only, so allow_dump needs to be required. 2. GlobalContext::emitFileHeader() needs to return gracefully instead of calling report_fatal_error(), to allow error tests to produce the right error output. BUG= none R=kschimpf@google.com Review URL: https://codereview.chromium.org/1202563002
-