Skip to content

Commit 2324d8c

Browse files
authored
Merge pull request #8266 from wuruilong01/develop
add support for loongarch64
2 parents 2a46ade + 15b61bb commit 2324d8c

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

src/util/config.cpp

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -672,6 +672,35 @@ void configt::ansi_ct::set_arch_spec_sh4()
672672
}
673673
}
674674

675+
void configt::ansi_ct::set_arch_spec_loongarch64()
676+
{
677+
set_LP64();
678+
endianness = endiannesst::IS_LITTLE_ENDIAN;
679+
long_double_width = 16 * 8;
680+
char_is_unsigned = false;
681+
NULL_is_zero = true;
682+
683+
switch(mode)
684+
{
685+
case flavourt::GCC:
686+
defines.push_back("__loongarch__");
687+
break;
688+
689+
case flavourt::VISUAL_STUDIO:
690+
UNREACHABLE; // not supported by Visual Studio
691+
break;
692+
693+
case flavourt::CODEWARRIOR:
694+
case flavourt::CLANG:
695+
case flavourt::ARM:
696+
case flavourt::ANSI:
697+
break;
698+
699+
case flavourt::NONE:
700+
UNREACHABLE;
701+
}
702+
}
703+
675704
configt::ansi_ct::c_standardt configt::ansi_ct::default_c_standard()
676705
{
677706
#if defined(__APPLE__)
@@ -756,6 +785,8 @@ void configt::set_arch(const irep_idt &arch)
756785
ansi_c.set_arch_spec_x86_64();
757786
else if(arch=="i386")
758787
ansi_c.set_arch_spec_i386();
788+
else if(arch == "loongarch64")
789+
ansi_c.set_arch_spec_loongarch64();
759790
else
760791
{
761792
// We run on something new and unknown.
@@ -1433,6 +1464,8 @@ irep_idt configt::this_architecture()
14331464
this_arch = "hppa";
14341465
#elif defined(__sh__)
14351466
this_arch = "sh4";
1467+
#elif defined(__loongarch__)
1468+
this_arch = "loongarch64";
14361469
#else
14371470
// something new and unknown!
14381471
this_arch = "unknown";

src/util/config.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ class configt
238238
void set_arch_spec_v850();
239239
void set_arch_spec_hppa();
240240
void set_arch_spec_sh4();
241+
void set_arch_spec_loongarch64();
241242
242243
enum class flavourt
243244
{

0 commit comments

Comments
 (0)