llvm.org GIT mirror llvm / 4586bde
[Triple] Add isRISCV function This matches isARM, isThumb, isAArch64 and similar helpers. Future commits which clean-up code that currently checks for Triple::riscv32 || Triple::riscv64. Differential Revision: https://reviews.llvm.org/D54215 Patch by Simon Cook. Test case added by Alex Bradbury. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@365327 91177308-0d34-0410-b5e6-96231b3b80d8 Alex Bradbury a month ago
2 changed file(s) with 7 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
724724 return getArch() == Triple::ppc64 || getArch() == Triple::ppc64le;
725725 }
726726
727 /// Tests whether the target is RISC-V (32- and 64-bit).
728 bool isRISCV() const {
729 return getArch() == Triple::riscv32 || getArch() == Triple::riscv64;
730 }
731
727732 /// Tests whether the target supports comdat
728733 bool supportsCOMDAT() const {
729734 return !isOSBinFormatMachO();
875875 EXPECT_FALSE(T.isArch16Bit());
876876 EXPECT_TRUE(T.isArch32Bit());
877877 EXPECT_FALSE(T.isArch64Bit());
878 EXPECT_TRUE(T.isRISCV());
878879
879880 T.setArch(Triple::riscv64);
880881 EXPECT_FALSE(T.isArch16Bit());
881882 EXPECT_FALSE(T.isArch32Bit());
882883 EXPECT_TRUE(T.isArch64Bit());
884 EXPECT_TRUE(T.isRISCV());
883885 }
884886
885887 TEST(TripleTest, BitWidthArchVariants) {