Support _Complex in hard-VFP abi
Commit Message
On 08/11/2014 09:12 PM, Will Newton wrote:
>> - array). Vectors and complex types are not currently supported,
>> > - matching the generic AAPCS support. */
>> > + array). Vectors types are not currently supported, matching the
> This should be "Vector types".
>
Fixed.
>> > + generic AAPCS support. */
>> >
>> > static int
>> > arm_vfp_cprc_sub_candidate (struct type *t,
>> > @@ -3589,6 +3589,36 @@ arm_vfp_cprc_sub_candidate (struct type *t,
>> > }
>> > break;
>> >
>> > + case TYPE_CODE_COMPLEX:
>> > + /* Arguments of complex T where T is one of the types float or
>> > + double get treated as if they are implemented as:
>> > +
>> > + struct complexT
>> > + {
>> > + T real;
>> > + T imag;
>> > + };*/
> A line break before closing the comment might look nicer here.
>
I add two spaces before closing the comment, because we don't move
"*/" to a separated line. Patch was approved by Joel, and is pushed
in.
Comments
On 08/19/2014 02:12 PM, Yao Qi wrote:
> On 08/11/2014 09:12 PM, Will Newton wrote:
>>>> + case TYPE_CODE_COMPLEX:
>>>> + /* Arguments of complex T where T is one of the types float or
>>>> + double get treated as if they are implemented as:
>>>> +
>>>> + struct complexT
>>>> + {
>>>> + T real;
>>>> + T imag;
>>>> + };*/
>> A line break before closing the comment might look nicer here.
>>
>
> I add two spaces before closing the comment, because we don't move
> "*/" to a separated line.
...
> + case TYPE_CODE_COMPLEX:
> + /* Arguments of complex T where T is one of the types float or
> + double get treated as if they are implemented as:
> +
> + struct complexT
> + {
> + T real;
> + T imag;
> + }; */
> + switch (TYPE_LENGTH (t))
This is borderline pedantry, but this looks ugly enough to me that
I'll speak up in case this ends up being the norm. :-) FWIW, I agree
with Will here -- I think we should make an exception to the rule
in the cases where the comment is actually a paste of output,
multiline code or similar cases. It's kind of like a @smallexample
region in texinfo, that begs to be rendered on its own block/lines,
separate from the text around it.
'grep -n "^[ |\t]\+\*/" *.h -B 3' finds several (many?) similar
examples (and a bunch of wrong-format comments too, though..)
<nit mode/>
Thanks,
Pedro Alves
@@ -1,3 +1,8 @@
+2014-08-19 Yao Qi <yao@codesourcery.com>
+
+ * arm-tdep.c (arm_vfp_cprc_sub_candidate): Handle _Complex
+ types.
+
2014-08-19 Alan Modra <amodra@gmail.com>
* acinclude.m4 (GDB_AC_CHECK_BFD): Don't add -ldl.
@@ -3557,8 +3557,8 @@ arm_vfp_cprc_reg_char (enum arm_vfp_cprc_base_type b)
classified from *BASE_TYPE, or two types differently classified
from each other, return -1, otherwise return the total number of
base-type elements found (possibly 0 in an empty structure or
- array). Vectors and complex types are not currently supported,
- matching the generic AAPCS support. */
+ array). Vector types are not currently supported, matching the
+ generic AAPCS support. */
static int
arm_vfp_cprc_sub_candidate (struct type *t,
@@ -3589,6 +3589,36 @@ arm_vfp_cprc_sub_candidate (struct type *t,
}
break;
+ case TYPE_CODE_COMPLEX:
+ /* Arguments of complex T where T is one of the types float or
+ double get treated as if they are implemented as:
+
+ struct complexT
+ {
+ T real;
+ T imag;
+ }; */
+ switch (TYPE_LENGTH (t))
+ {
+ case 8:
+ if (*base_type == VFP_CPRC_UNKNOWN)
+ *base_type = VFP_CPRC_SINGLE;
+ else if (*base_type != VFP_CPRC_SINGLE)
+ return -1;
+ return 2;
+
+ case 16:
+ if (*base_type == VFP_CPRC_UNKNOWN)
+ *base_type = VFP_CPRC_DOUBLE;
+ else if (*base_type != VFP_CPRC_DOUBLE)
+ return -1;
+ return 2;
+
+ default:
+ return -1;
+ }
+ break;
+
case TYPE_CODE_ARRAY:
{
int count;