| 994 | } |
| 995 | |
| 996 | void kprintf::handleAlignedDataAccess(char **_src, char **_dst) |
| 997 | { |
| 998 | int numCharsWritten = 0; |
| 999 | char id1[256]; |
| 1000 | char id2[256]; |
| 1001 | char * ptr, * offsetptr; |
| 1002 | char *src = *_src; |
| 1003 | char *dst = *_dst; |
| 1004 | |
| 1005 | ptr = mystrtok( src, "()"); |
| 1006 | ptr = mystrtok( NULL, "()"); |
| 1007 | strcpy( id1, ptr); |
| 1008 | *_src = ptr + strlen(ptr) + 1; |
| 1009 | strcpy( id2, id1); |
| 1010 | |
| 1011 | // To skip offset in id1 |
| 1012 | ptr = id1; |
| 1013 | for( int i=0;;i++, ptr++) |
| 1014 | { |
| 1015 | if ( *ptr == ',') |
| 1016 | break; |
| 1017 | } |
| 1018 | ptr++; |
| 1019 | |
| 1020 | if (( ! this->doVLOAD) || (effectiveVectorWidthOnBaseType == 1)) |
| 1021 | { |
| 1022 | numCharsWritten = sprintf(dst, "*((__global %s*)(%s))", DERIVED, ptr); |
| 1023 | dst += numCharsWritten; |
| 1024 | } |
| 1025 | else |
| 1026 | { |
| 1027 | offsetptr = id2; |
| 1028 | for( int i=0; ; i++, offsetptr++) |
| 1029 | { |
| 1030 | if ( *offsetptr == ',') |
| 1031 | break; |
| 1032 | } |
| 1033 | offsetptr++; |
| 1034 | *offsetptr = '\0'; |
| 1035 | |
| 1036 | const char *string; |
| 1037 | char vecSuffix[3] = {0}; |
| 1038 | char tempStr[9] = {0}; |
| 1039 | |
| 1040 | generateVecSuffix( vecSuffix, effectiveVectorWidthOnBaseType); // VLOAD %TYPE%V from %PTYPE kind of memory locations |
| 1041 | strcpy( tempStr, "vload"); |
| 1042 | strcat( tempStr, vecSuffix); |
| 1043 | string = findTypeVLOAD(tempStr); |
| 1044 | if (string != NULL) |
| 1045 | { |
| 1046 | put( "%VLOAD", string); |
| 1047 | } else { |
| 1048 | std::cerr << "handleAlignedDataAccess: " << tempStr << " not a valid VLOAD type" << std::endl; |
| 1049 | } |
| 1050 | |
| 1051 | |
| 1052 | struct fmt f; |
| 1053 | f = get("%PTYPE"); |