aboutsummaryrefslogtreecommitdiffstats
path: root/lib/hipe/x86
AgeCommit message (Collapse)Author
2018-01-29make HiPE work on x86_64 when PIE is enabledbhuztez
Currently HiPE amd64 assumes the runtime system code is loaded into the low 2G of the address space. However, this is not the case when PIE is enabled, it is loaded into a random location. So trampolines are required to call BIFs, and also we have first to load the address of sse2_fnegate_mask to a regisiter before xorpd in fchs.
2017-03-27Merge PR-1386 from kostis/hipe-const-alignment OTP-14302Sverker Eriksson
hipe: Fix alignment of byte-sized constants
2017-03-23Remove (now) unnecessary argument of pack_constantsKostis Sagonas
2017-03-16hipe: Add pseudo_spill_f?move instructionsMagnus Lång
These pseudo instructions are added to all backends and allow spill slot to spill slot move coalescing in a clean way. They have regular move semantics, but contain an additional scratch register to be used if both source and destination are spilled, and can not be move coalesced. Additionally, a register allocator callback Target:is_spill_move(Instr, Context) is added which allows the spill slot allocators to check for these instructions and try to coalesce the spill slots the two temporaries are allocated to.
2017-03-16hipe: Add branch prediction accessor ra callbacksMagnus Lång
Adds a new register allocator callback Target:branch_preds(Instr, Context) which, for a control flow instruction Instr, returns a list of tuples {Target, Probability} for each label name Target that Instr may branch to. Probability is a float between 0.0 and 1.0 and corresponds to the predicted probability that control flow branches to the corresponding target. The probabilities may sum to at most 1.0 (rounding errors aside). Note that a sum less than 1.0 is valid.
2017-03-16hipe: Add basic range splitting ra callbacksMagnus Lång
In addition to the temporary name rewriting that hipe_regalloc_prepass does, range splitters also need to be able to insert move instructions, as well as inserting new basic blocks in the control flow graph. The following four callbacks are added for that purpose: * Target:mk_move(Src, Dst, Context) Returns a move instruction from the temporary (not just register number) Src to Dst. * Target:mk_goto(Label, Context) Returns a unconditional control flow instruction that branches to the label with name Label. * Target:redirect_jmp(Instr, ToOld, ToNew, Context) Modifies the control flow instruction Instr so that any control flow that would go to a label with name ToOld instead goes to the label with name ToNew. * Target:new_label(Context) Returns a fresh label name that does not belong to any existing block in the current function, and is to be used to create a new basic block in the control flow graph by calling Target:update_bb/4 with this new name.
2017-03-16hipe_x86_subst: Fix bug with zero-arity #fp_unop{}Magnus Lång
2017-03-06hipe_x86_assemble: 32-bit forms for movzx and xor-selfMagnus Lång
2017-03-06hipe_x86_postpass: Enable ElimSet0 ruleMagnus Lång
2017-03-06hipe_x86: CleanupMagnus Lång
2016-11-23Remove obsolete CVS keyword markupRichard Carlsson
2016-11-23Correct copyright on remaining hipe filesRichard Carlsson
2016-11-16hipe_x86: Fix encoding of test instr w/ neg immMagnus Lång
Also, use byte form for immediates up to 255, since there's no sign extension in byte form. HiPE seems to never generate negative test immediates currently, but we should at least not output incorrect encodings.
2016-11-16hipe_x86_postpass: Negate conditions in goto elimMagnus Lång
2016-11-15hipe_rtl_to_x86: Use LEA only for immediate addsMagnus Lång
It seems that most 3-address adds of temps can be move coalesced. Therefore, we limit the behaviour added by 1567585dda8 to only affect immediate adds. Also, add conversion of immediate mov+sub to lea.
2016-11-15hipe_x86: LeaToAdd peephole ruleMagnus Lång
Although LEA is useful for three-address form adds, sometimes it is used where a normal add would have sufficed (due to the addition being the last use of one of the operands; but RTL lowering does not know that as it does not have liveness information). As a workaround, we convert LEA back to ADD when the destination is the same as one of the operands.
2016-11-15hipe_rtl: unify branch and alubMagnus Lång
branch and alub overlap in their use cases, but the backends rely on knowing that the result is unused in their lowering of branch. By extending alub so that the destination is optional, it can fully replace branch. This simplifies rtl by reducing code duplication and the number of instructions. Also, in the x86 and arm backends, we can now use 'test' and {'tst','mvn','teq'} to lower some alubs without destinations. This is particularly good for x86, as sequences such as 'is_boxed' type tests now get shorter (both from not needing a mov to copy the variable, but also from the fact that 'testb' encodes shorter than 'andq').
2016-11-15hipe_x86: Fix&activate ElimCmp0 peephole ruleMagnus Lång
2016-11-15hipe_{x86,amd64}: Finish test instr implementationMagnus Lång
2016-09-05hipe: Refactor ra callbacks to accept context argMagnus Lång
This allows us to pass around the context data that hipe_regalloc_prepass needs cleanly, without using process dictionary or parameterised modules (like it was previous to this change).
2016-09-05hipe: Reuse liveness between regalloc iterationsMagnus Lång
This is sound because the liveness data structure only stores liveness info at basic block boundaries, and the rewrites that happen in TargetSpecific:check_and_rewrite/2 preserves all existing definitions and uses, and all new liveness intervals, belonging to newly introduced temporaries, are always local to a basic block, and thus do not show up in the liveout or livein sets for the basic block.
2016-09-02hipe_x86: Add code rewrite RA callbacksMagnus Lång
These will not only be useful for hipe_regalloc_prepass, but also, after the introduction of a mk_move/2 (or similar) callback, for the purpose of range splitting. Since the substitution needed to case over all the instructions, a new module, hipe_x86_subst, was introduced to the x86 backend. Due to differences in the 'jtab' field of a #jmp_switch{} between x86 and amd64, it regrettably needed to be duplicated to hipe_amd64_subst.
2016-09-02Simplify hipe_x86_ra_finalise:conv_ra_maplet/3Magnus Lång
2016-09-02hipe_x86: Simplify ra_postconditions is_mem_opndMagnus Lång
This is due to the improvements in hipe_temp_map, removing the need for duplicated logic in the backends.
2016-09-02hipe_x86: Fix pseudo_tailcall prettyprintingMagnus Lång
2016-09-02hipe_x86: Extra sanity assertionsMagnus Lång
2016-09-02hipe: Add hipe_regalloc_prepassMagnus Lång
hipe_regalloc_prepass speeds up register allocation by spilling any temp that is live over a call (which clobbers all register). In order to detect these, a new function was added to the target interface; defines_all_alloc/1, that takes an instruction and returns a boolean.
2016-08-30hipe_x86: Use lea instead of move+addMagnus Lång
This is primarily useful for heap allocations, as a two-address 'add' can't be used to both copy the heap pointer to another register, and add the tag.
2016-08-30hipe: Reuse liveness info for spillminMagnus Lång
For x86, additionally reuse liveness from float LSRA for the GP LSRA.
2016-08-30hipe_x86: Minimise CFG<->linear conversionsMagnus Lång
Most x86 passes were either linearise(pass(to_cfg(Code))) or trivially rewritable to process a CFG. This saves a great deal of time and memory churn when compiling large programs. Now, there will only ever be a single Linear->CFG conversion, just after lowering from RTL, and only ever a single CFG->Linear conversion, just before the finalise pass. Both of these now happen in hipe_x86_main.
2016-08-30hipe_x86: Be resilient to crappy RTLMagnus Lång
The x86 backend crashes if certain RTL optimisations were omitted, preventing it from being usable at lower optimisation levels.
2016-08-30hipe_x86: LSRA for SSE2Magnus Lång
There is little point offering LSRA for x86 if we're still going to call hipe_graph_coloring_regalloc for the floats. In particular, all allocators except LSRA allocates an N^2 interference matrix, making them unusable for really large functions.
2016-08-26Merge branch 'maint'Sverker Eriksson
2016-08-22hipe_x86: Fix illegal inst from peephole optMagnus Lång
2016-07-11hipe_x86_frame: speed up find_tempsMagnus Lång
2016-05-31Add compiler option -Werror to MakefilesKostis Sagonas
and correct the name of another, erroneously spelt, option in the process.
2016-03-15update copyright-yearHenrik Nord
2015-08-31erts,hipe,dialyzer: Fix hipe checkum of target runtime systemSverker Eriksson
Main problem: A faulty HIPE_LITERAL_CRC was not detected by the loader. Strangeness #1: Dialyzer should ask the hipe compiler about the target checksum, not an internal bif. Strangeness #2: The HIPE_SYSTEM_CRC checksum was based on the HIPE_LITERALS_CRC checksum. Solution: New HIPE_ERTS_CHECKSUM which is an bxor of the two (now independent) HIPE_LITERALS_CRC and HIPE_SYSTEM_CRC. HIPE_LITERALS_CRC represents values that are assumed to stay constant for different VM configurations of the same arch, and are therefor hard coded into the hipe compiler. HIPE_SYSTEM_CRC represents values that may differ between VM variants. By default the hipe compiler asks the running VM for this checksum, in order to create beam files for the same running VM. The hipe compiler can be configured (with "make XCOMP=yes ...") to create beam files for another VM variant, in which case HIPE_SYSTEM_CRC is also hard coded. ToDo: Treat all erts properties the same. Either ask the running VM or hard coded into hipe (if XCOMP=yes). This will simplify and reduce the risk of dangerous mismatches. One concern might be the added overhead from more frequent calls to hipe_bifs:get_rts_param.
2015-06-18Change license text to APLv2Bruce Yinhe
2015-01-11hipe: backends: correct #fconv{} translationMikael Pettersson
RTL can produce an #fconv{} instruction with an immediate operand, but the backends unconditionally access the operand as a temporary. This results in broken representation in the backends and eventually they crash.
2014-03-07Move some common code in hipe_pack_constantsYiannis Tsiouris
All backends (e.g. arm, ppc, sparc, x86) share the same code for the following functions: * find_const/2, * mk_data_relocs/2, and * slim_sorted_exportmap/3 This commit moves those definitions (along with some helper functions) in misc/hipe_pack_constants.erl and adds the appropriate specs. This is a structural change; no change in semantics intented.
2013-04-19Remove the "coding: utf-8" comment from all Erlang source filesHans Bolinder
2013-01-09Prepare OTP files for Unicode as default encodingHans Bolinder
2012-06-05Update to work with whitespace in exec pathLukas Larsson
OTP-10106 OTP-10107
2012-03-30Update copyright yearsBjörn-Egil Dahlberg
2012-02-28Make hipe hipe-compiled w/ --enable-native-libsPatrik Nyblom
2010-09-24Cleanup and small fixes in hipe filesKostis Sagonas
2010-01-26OTP-8343 The documentation is now possible to build in an open sourceLars G Thorsen
environment after a number of bugs are fixed and some features are added in the documentation build process. - The arity calculation is updated. - The module prefix used in the function names for bif's are removed in the generated links so the links will look like http://www.erlang.org/doc/man/erlang.html#append_element-2 instead of http://www.erlang.org/doc/man/erlang.html#erlang:append_element-2 - Enhanced the menu positioning in the html documentation when a new page is loaded. - A number of corrections in the generation of man pages (thanks to Sergei Golovan) - Moved some man pages to more apropriate sections, pages in section 4 moved to 5 and pages in 6 moved to 7. - The legal notice is taken from the xml book file so OTP's build process can be used for non OTP applications.
2009-11-20The R13B03 release.OTP_R13B03Erlang/OTP