Author: zhuqing
Date: 2011-09-23 02:34:31 -0400 (Fri, 23 Sep 2011)
New Revision: 3741
Modified:
trunk/osprey/be/cg/ia64/cgtarget.cxx
trunk/osprey/be/cg/ia64/exp_loadstore.cxx
trunk/osprey/be/cg/localize.cxx
trunk/osprey/be/cg/whirl2ops.cxx
Log:
Fix bug792, support constraint "b" used in inline asm on IA-64.
Code Review:Jian-xin.
Modified: trunk/osprey/be/cg/ia64/cgtarget.cxx
===================================================================
--- trunk/osprey/be/cg/ia64/cgtarget.cxx 2011-09-22 08:42:08 UTC (rev
3740)
+++ trunk/osprey/be/cg/ia64/cgtarget.cxx 2011-09-23 06:34:31 UTC (rev
3741)
@@ -3650,6 +3650,13 @@
ret_tn = (pref_tn ? pref_tn : Build_TN_Of_Mtype(rtype));
}
+ else if (*constraint == 'b') {
+ TYPE_ID rtype = (load != NULL ? WN_rtype(load) : Pointer_Mtype);
+ FmtAssert(rtype == Pointer_Mtype,
+ ("ASM operand does not satisfy its constraint"));
+ ret_tn = (pref_tn ? pref_tn : Build_TN_Of_Mtype(MTYPE_A8));
+ }
+
else {
FmtAssert(FALSE, ("ASM constraint <%s> not supported", constraint));
}
Modified: trunk/osprey/be/cg/ia64/exp_loadstore.cxx
===================================================================
--- trunk/osprey/be/cg/ia64/exp_loadstore.cxx 2011-09-22 08:42:08 UTC (rev
3740)
+++ trunk/osprey/be/cg/ia64/exp_loadstore.cxx 2011-09-23 06:34:31 UTC (rev
3741)
@@ -169,9 +169,14 @@
Build_OP (top, result, True_TN, Gen_Enum_TN(ldhint), base, ops);
} else {
ISA_ENUM_CLASS_VALUE ldtype = Pick_Load_Type (variant, mtype);
- Build_OP (top, result, True_TN,
+ // can not load to branch register directly
+ TN* tmp_res = (TN_register_class(result) == ISA_REGISTER_CLASS_branch) ?
+ Build_TN_Of_Mtype(mtype) : result;
+ Build_OP (top, tmp_res, True_TN,
Gen_Enum_TN(ldtype), Gen_Enum_TN(ldhint),
base, ops);
+ if (tmp_res != result)
+ Exp_COPY(result, tmp_res, ops);
}
}
@@ -260,8 +265,14 @@
Build_OP (top, True_TN, Gen_Enum_TN(sthint), base, src, ops);
} else {
ISA_ENUM_CLASS_VALUE sttype = Pick_Store_Type (variant);
+ // can not store branch register to memory directly
+ TN* tmp_src = src;
+ if (TN_register_class(src) == ISA_REGISTER_CLASS_branch) {
+ tmp_src = Build_TN_Of_Mtype(mtype);
+ Exp_COPY(tmp_src, src, ops);
+ }
Build_OP (top, True_TN, Gen_Enum_TN(sttype), Gen_Enum_TN(sthint),
- base, src, ops);
+ base, tmp_src, ops);
}
}
@@ -491,8 +502,14 @@
}
Reset_TN_is_fpu_int(result);
}
- else
- Expand_Composed_Load(op, result, base, disp, variant, ops);
+ else {
+ // can not load to branch register directly
+ TN* tmp_res = (TN_register_class(result) == ISA_REGISTER_CLASS_branch) ?
+ Build_TN_Of_Mtype(rtype) : result;
+ Expand_Composed_Load(op, tmp_res, base, disp, variant, ops);
+ if (tmp_res != result)
+ Exp_COPY(result, tmp_res, ops);
+ }
}
@@ -608,8 +625,15 @@
/*NOTREACHED*/
}
}
- else
- Expand_Composed_Store(mtype, obj, base, disp, variant, ops);
+ else {
+ // can not store branch register to memory directly
+ TN* tmp_obj = obj;
+ if (TN_register_class(obj) == ISA_REGISTER_CLASS_branch) {
+ tmp_obj = Build_TN_Of_Mtype(mtype);
+ Exp_COPY(tmp_obj, obj, ops);
+ }
+ Expand_Composed_Store(mtype, tmp_obj, base, disp, variant, ops);
+ }
}
static void
Modified: trunk/osprey/be/cg/localize.cxx
===================================================================
--- trunk/osprey/be/cg/localize.cxx 2011-09-22 08:42:08 UTC (rev 3740)
+++ trunk/osprey/be/cg/localize.cxx 2011-09-23 06:34:31 UTC (rev 3741)
@@ -534,8 +534,11 @@
{
if (def && BB_call(current_bb))
; // okay
- else if (def && BB_asm(current_bb))
+ else if (BB_asm(current_bb))
; // okay
+ else if (BB_prev(current_bb) != NULL
+ && BB_asm(BB_prev(current_bb)))
+ ; // okay
else if (def && !BB_call(current_bb)) {
Localize_Global_Param_Reg (current_bb, tn);
}
Modified: trunk/osprey/be/cg/whirl2ops.cxx
===================================================================
--- trunk/osprey/be/cg/whirl2ops.cxx 2011-09-22 08:42:08 UTC (rev 3740)
+++ trunk/osprey/be/cg/whirl2ops.cxx 2011-09-23 06:34:31 UTC (rev 3741)
@@ -1421,6 +1421,10 @@
else {
i += Int_Preg_Min_Offset;
}
+#elif defined(TARG_IA64)
+ else if (TN_register_class(tn) == ISA_REGISTER_CLASS_branch) {
+ i += Branch_Preg_Min_Offset;
+ }
#endif
return i;
}
------------------------------------------------------------------------------
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-d2dcopy2
_______________________________________________
Open64-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/open64-devel