-
Notifications
You must be signed in to change notification settings - Fork 138
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[RISCV] Port Classic Flang to 64-bit RISC-V
- Loading branch information
Showing
19 changed files
with
10,261 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* | ||
* Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
* See https://llvm.org/LICENSE.txt for license information. | ||
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
* | ||
*/ | ||
|
||
#include <sys/ucontext.h> | ||
#include <stdio.h> | ||
#include <stdint.h> | ||
#include <inttypes.h> | ||
#include <ctype.h> | ||
#include "stdioInterf.h" | ||
|
||
typedef struct { | ||
int rn; // Register index in to "regs" pointer | ||
char *s; // Symbolic name of register | ||
} gprs_t; | ||
|
||
|
||
/* | ||
* The way the structure below is organized, the registers are all | ||
* sequential with no gaps - the structure is probably overkill - but | ||
* allows for some flexibility. | ||
*/ | ||
|
||
gprs_t gprs[] = { | ||
{ 0, "x0" }, { 1, "x1" }, { 2, "x2"}, { 3, "x3" }, { 4, "x4" }, | ||
{ 5, "x5" }, { 6, "x6" }, { 7, "x7" }, { 8, "x8" }, { 9, "x9" }, | ||
{10, "x10"}, {11, "x11"}, {12, "x12"}, {13, "x13"}, {14, "x14"}, | ||
{15, "x15"}, {16, "x16"}, {17, "x17"}, {18, "x18"}, {19, "x19"}, | ||
{20, "x20"}, {21, "x21"}, {22, "x22"}, {23, "x23"}, {24, "xr24"}, | ||
{25, "x25"}, {26, "x26"}, {27, "x27"}, {28, "x28"}, {29, "x29"}, | ||
{30, "x30"}, {31, "x31"}, | ||
}; | ||
|
||
void | ||
dumpregs(uint64_t *regs) | ||
{ | ||
int i; | ||
int j; | ||
char *pc = NULL; | ||
|
||
if (regs == NULL) | ||
return; // Not sure if this is possible | ||
|
||
/* | ||
* Output has the following format: | ||
* <REG> <HEXADECIMAL> <DECIMAL> <ASCII> | ||
* Example: | ||
* r0 0x00003fffaf4a309c 70367390085276 .0J..?.. | ||
* sp 0x00003ffff437d1a0 70368546509216 ..7..?.. | ||
* toc 0x0000000010019300 268538624 ........ | ||
* r3 0x0000000010000e64 268439140 d....... | ||
* ... | ||
*/ | ||
|
||
for (i = 0; i < sizeof gprs / sizeof *gprs; ++i) { | ||
fprintf(__io_stderr(), " %-8s 0x%016" PRIx64 " %20" PRId64 "\t", | ||
gprs[i].s, regs[gprs[i].rn], regs[gprs[i].rn]); | ||
pc = (char *)&(regs[gprs[i].rn]); | ||
for (j = 0; j < 8; ++j) { | ||
fputc(isprint(pc[j]) ? pc[j] : '.', __io_stderr()); | ||
} | ||
fputs("\n", __io_stderr()); | ||
} | ||
} | ||
|
||
uint64_t * | ||
getRegs(ucontext_t *u) | ||
{ | ||
mcontext_t *mc = &u->uc_mcontext; | ||
return (uint64_t *)&(mc->__gregs); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/* | ||
* Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
* See https://llvm.org/LICENSE.txt for license information. | ||
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
* | ||
*/ | ||
|
||
/* flgdf.h - data definitions for FTN compiler flags */ | ||
|
||
FLG flg = { | ||
false, /* asm = -noasm */ | ||
false, /* list = -nolist */ | ||
true, /* object = -object */ | ||
false, /* xref = -show noxref */ | ||
false, /* code = -show nocode */ | ||
false, /* include = -show noinclude */ | ||
0, /* debug = -nodebug */ | ||
1, /* opt = -opt 1 */ | ||
true, /* depchk = -depchk on */ | ||
false, /* depwarn = -depchk warn */ | ||
false, /* dclchk = -nodclchk */ | ||
false, /* locchk = -nolocchk */ | ||
false, /* onetrip = -noonetrip */ | ||
false, /* save = -nosave */ | ||
1, /* inform = -inform informational */ | ||
0xFFFFFFFF, /* xoff */ | ||
0x00000000, /* xon */ | ||
false, /* ucase = -noucase */ | ||
NULL, /* idir == empty list */ | ||
NULL, /* linker_directives == empty list */ | ||
NULL, /* llvm_target_triple == empty ptr */ | ||
NULL, /* target_features == empty ptr */ | ||
0, /* vscale_range_min = -vscale_range_min 0 */ | ||
0, /* vscale_range_max = -vscale_range_max 0 */ | ||
false, /* dlines = -nodlines */ | ||
72, /* extend_source = -noextend_source */ | ||
true, /* i4 = -i4 */ | ||
false, /* line = -noline */ | ||
false, /* symbol = -nosymbol */ | ||
0, /* profile = no profiling */ | ||
false, /* standard = don't flag non-F77 uses */ | ||
{0}, /* dbg[] */ | ||
true, /* align doubles on doubleword boundary */ | ||
0, /* astype - assembler syntax - 0-elf, 1-coff */ | ||
false, /* recursive = -norecursive */ | ||
0, /* ieee: 0 == none: num == bit value for | ||
item (fdiv==1,ddiv==2) */ | ||
0, /* inline: 0 == none: num == max # ilms */ | ||
0, /* autoinline */ | ||
0, /* vect: 0 = none: num == vect item */ | ||
0, /* little endian */ | ||
false, /* not terse for summary, etc. */ | ||
'_', /* default is to change '$' to '_' */ | ||
{0}, /* x flags */ | ||
false, /* don't quad align "unconstrained objects"; | ||
use natural alignment */ | ||
false, /* anno - don't annotate asm file */ | ||
false, /* qa = -noqa */ | ||
false, /* es = -noes */ | ||
false, /* p = preprocessor does not emit # lines in its output */ | ||
0, /* def ptr */ | ||
NULL, /* search the standard include */ | ||
false, /* don't allow smp directives */ | ||
false, /* omptarget - don't allow OpenMP Offload directives */ | ||
25, /* errorlimit */ | ||
false, /* trans_inv */ | ||
0, /* tpcount */ | ||
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* tpvalue */ | ||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, | ||
"", /* cmdline */ | ||
false, /* qp */ | ||
}; |
Oops, something went wrong.