Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(113)

Unified Diff: gcc/config/i386/i386.c

Side-by-side diff isn't available for this file because of its large size.
Issue 10386087: Replace rip lea with eip (Closed) Base URL: http://git.chromium.org/native_client/nacl-gcc.git@master
Patch Set: remove [gcc] prefix Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
Download patch
« no previous file with comments | « no previous file | gcc/config/i386/i386.md » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gcc/config/i386/i386.c
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 8f0111a8b3da630b15889d3f9701fc6df9ac7323..85bd11214d75ed3994264e565c87fb83fa917ff5 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -9082,6 +9082,42 @@ ix86_lea_decompose_address (rtx addr, struct ix86_address *out)
return retval;
}
+
+/* Returns true if NaCl-special registers are used: %rbp, %rsp, %rip. */
+int
+nacl_address_uses_special_registers (rtx op)
+{
+ if (TARGET_NACL)
+ {
+ struct ix86_address parts;
+ rtx symbol;
+ int ok;
+
+ ok = ix86_lea_decompose_address (operands[1], &parts);
+ gcc_assert (ok);
+
+ /* Check for %rbp/%rsp. */
+ if (parts.base &&
+ (REGNO (parts.base) == SP_REG || REGNO (parts.base) == BP_REG))
+ return 1;
+
+ /* Checks for %rip are borrowed from print_operand_address_parts. */
+ if (!parts.base && !parts.index)
+ {
+ symbol = parts.disp;
+ if (GET_CODE (symbol) == CONST
+ && GET_CODE (XEXP (symbol, 0)) == PLUS
+ && CONST_INT_P (XEXP (XEXP (symbol, 0), 1)))
+ symbol = XEXP (XEXP (symbol, 0), 0);
+ if (GET_CODE (symbol) == SYMBOL_REF ||
+ GET_CODE (symbol) == LABEL_REF)))
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
int
lea_match_address_operand (rtx op, enum machine_mode mode)
{
« no previous file with comments | « no previous file | gcc/config/i386/i386.md » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698