Author: laijx
Date: 2011-07-11 05:04:36 -0400 (Mon, 11 Jul 2011)
New Revision: 3688
Modified:
trunk/osprey/be/opt/opt_htable.cxx
Log:
For the ILOAD from address const 0xffffffffffff8001, the WHIRL IR is:
U8INTCONST -32767 (0xffffffffffff8001)
I4I4ILOAD 0 T<4,.predef_I4,4> T<53,anon_ptr.,8>
when creating the CODEREP, after calling CANON_CR::Trim_to_16bits(),
the base of ILOAD will be trunk to 0 and -32767 will be stored to the
offset of the ILOAD. In current WOPT, the generated IR is:
U4INTCONST 0 (0x0)
I4I4ILOAD -32767 T<4,.predef_I4,4> T<53,anon_ptr.,8>
We can find the type of the address is converted to U4. This is done
by CODEREP::Set_dtyp_const_val(MTYPE dt, INT64 v). When the constant
is in the range of U4, the dtyp will be set to U4. This will cause bad
code generation in CG. Since both the base and offset are 4 bytes, the
CG will generate ldc32 for the constant and finally generate the movl
instruction.
This patch will force the dtyp of address expression to be pointer type.
Code reviewed and approved by Sun Chan.
Modified: trunk/osprey/be/opt/opt_htable.cxx
===================================================================
--- trunk/osprey/be/opt/opt_htable.cxx 2011-07-10 03:57:44 UTC (rev 3687)
+++ trunk/osprey/be/opt/opt_htable.cxx 2011-07-11 09:04:36 UTC (rev 3688)
@@ -2534,6 +2534,10 @@
CODEREP *retv;
OPERATOR oper = OPCODE_operator(opc);
+ // make sure the dtyp for address const is Pointer_type
+ if (lbase->Kind() == CK_CONST && lbase->Dtyp() != Pointer_type)
+ lbase->Set_dtyp_strictly(Pointer_type);
+
cr->Init_ivar(opc, dtyp, occ, dsctyp, lodty, lbase, sbase,
ofst, size, field_id);
// all IVAR codereps have a mu_node
------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
Open64-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/open64-devel