mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-20 20:19:32 +00:00
ICU-6362 support for msvc assembly - old merge from trunk r25698 vs http://source.icu-project.org/repos/icu/icu/branches/srl/config6362 r25699
X-SVN-Rev: 25703
This commit is contained in:
parent
89aa66303d
commit
d84fe470f6
1 changed files with 40 additions and 10 deletions
|
@ -48,6 +48,9 @@
|
|||
|
||||
#define MAX_COLUMN ((uint32_t)(0xFFFFFFFFU))
|
||||
|
||||
#define HEX_0X 0 /* 0x1234 */
|
||||
#define HEX_0H 1 /* 01234h */
|
||||
|
||||
#if defined(U_WINDOWS) || defined(U_ELF)
|
||||
#define CAN_GENERATE_OBJECTS
|
||||
#endif
|
||||
|
@ -110,6 +113,8 @@ static const struct AssemblyType {
|
|||
const char *name;
|
||||
const char *header;
|
||||
const char *beginLine;
|
||||
const char *footer;
|
||||
int8_t hexType; /* HEX_0X or HEX_0h */
|
||||
} assemblyHeader[] = {
|
||||
{"gcc",
|
||||
".globl %s\n"
|
||||
|
@ -119,7 +124,7 @@ static const struct AssemblyType {
|
|||
"\t.type %s,@object\n"
|
||||
"%s:\n\n",
|
||||
|
||||
".long "
|
||||
".long ","",HEX_0X
|
||||
},
|
||||
{"gcc-darwin",
|
||||
/*"\t.section __TEXT,__text,regular,pure_instructions\n"
|
||||
|
@ -130,7 +135,7 @@ static const struct AssemblyType {
|
|||
"\t.align 4\n" /* 1<<4 = 16 */
|
||||
"_%s:\n\n",
|
||||
|
||||
".long "
|
||||
".long ","",HEX_0X
|
||||
},
|
||||
{"gcc-cygwin",
|
||||
".globl _%s\n"
|
||||
|
@ -138,7 +143,7 @@ static const struct AssemblyType {
|
|||
"\t.align 8\n" /* Either align 8 bytes or 2^8 (256) bytes. 8 bytes is needed. */
|
||||
"_%s:\n\n",
|
||||
|
||||
".long "
|
||||
".long ","",HEX_0X
|
||||
},
|
||||
{"sun",
|
||||
"\t.section \".rodata\"\n"
|
||||
|
@ -146,7 +151,7 @@ static const struct AssemblyType {
|
|||
".globl %s\n"
|
||||
"%s:\n",
|
||||
|
||||
".word "
|
||||
".word ","",HEX_0X
|
||||
},
|
||||
{"sun-x86",
|
||||
"Drodata.rodata:\n"
|
||||
|
@ -156,7 +161,7 @@ static const struct AssemblyType {
|
|||
"\t.align 8\n"
|
||||
"%s:\n",
|
||||
|
||||
".4byte "
|
||||
".4byte ","",HEX_0X
|
||||
},
|
||||
{"xlc",
|
||||
".globl %s{RO}\n"
|
||||
|
@ -164,7 +169,7 @@ static const struct AssemblyType {
|
|||
"%s:\n"
|
||||
"\t.csect %s{RO}, 4\n",
|
||||
|
||||
".long "
|
||||
".long ","",HEX_0X
|
||||
},
|
||||
{"aCC-ia64",
|
||||
"\t.file \"%s.s\"\n"
|
||||
|
@ -175,7 +180,7 @@ static const struct AssemblyType {
|
|||
"\t.align 16\n"
|
||||
"%s::\t",
|
||||
|
||||
"data4 "
|
||||
"data4 ","",HEX_0X
|
||||
},
|
||||
{"aCC-parisc",
|
||||
"\t.SPACE $TEXT$\n"
|
||||
|
@ -184,11 +189,23 @@ static const struct AssemblyType {
|
|||
"\t.EXPORT %s\n"
|
||||
"\t.ALIGN 16\n",
|
||||
|
||||
".WORD "
|
||||
".WORD ","",HEX_0X
|
||||
},
|
||||
{ "masm",
|
||||
"\tTITLE %s\n"
|
||||
"; generated by genccode\n"
|
||||
".386\n"
|
||||
".model flat\n"
|
||||
"\tPUBLIC _%s\n"
|
||||
"ICUDATA_%s\tSEGMENT READONLY PARA PUBLIC FLAT 'DATA'\n"
|
||||
"\tALIGN 16\n"
|
||||
"_%s\tLABEL DWORD\n",
|
||||
"\tDWORD ","\nICUDATA_%s\tENDS\n\tEND\n",HEX_0H
|
||||
}
|
||||
};
|
||||
|
||||
static int32_t assemblyHeaderIndex = -1;
|
||||
static int32_t hexType = HEX_0X;
|
||||
|
||||
U_CAPI void U_EXPORT2
|
||||
printAssemblyHeadersToStdErr() {
|
||||
|
@ -208,6 +225,7 @@ checkAssemblyHeaderName(const char* optAssembly) {
|
|||
for (idx = 0; idx < (int32_t)(sizeof(assemblyHeader)/sizeof(assemblyHeader[0])); idx++) {
|
||||
if (uprv_strcmp(optAssembly, assemblyHeader[idx].name) == 0) {
|
||||
assemblyHeaderIndex = idx;
|
||||
hexType = assemblyHeader[idx].hexType; /* set the hex type */
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
@ -283,6 +301,11 @@ writeAssemblyCode(const char *filename, const char *destdir, const char *optEntr
|
|||
|
||||
T_FileStream_writeLine(out, "\n");
|
||||
|
||||
sprintf(bufferStr, assemblyHeader[assemblyHeaderIndex].footer,
|
||||
entry, entry, entry, entry,
|
||||
entry, entry, entry, entry);
|
||||
T_FileStream_writeLine(out, bufferStr);
|
||||
|
||||
if(T_FileStream_error(in)) {
|
||||
fprintf(stderr, "genccode: file read error while generating from file %s\n", filename);
|
||||
exit(U_FILE_ACCESS_ERROR);
|
||||
|
@ -444,8 +467,12 @@ write32(FileStream *out, uint32_t bitField, uint32_t column) {
|
|||
else {
|
||||
int seenNonZero = 0; /* This is used to remove leading zeros */
|
||||
|
||||
*(s++)='0';
|
||||
*(s++)='x';
|
||||
if(hexType==HEX_0X) {
|
||||
*(s++)='0';
|
||||
*(s++)='x';
|
||||
} else if(hexType==HEX_0H) {
|
||||
*(s++)='0';
|
||||
}
|
||||
|
||||
/* This creates a 32-bit field */
|
||||
#if U_IS_BIG_ENDIAN
|
||||
|
@ -461,6 +488,9 @@ write32(FileStream *out, uint32_t bitField, uint32_t column) {
|
|||
seenNonZero = 1;
|
||||
}
|
||||
}
|
||||
if(hexType==HEX_0H) {
|
||||
*(s++)='h';
|
||||
}
|
||||
}
|
||||
|
||||
*(s++)=0;
|
||||
|
|
Loading…
Add table
Reference in a new issue