Skip to content

Commit

Permalink
Update to use with Xcode 10, SDK v4.5.11 and get rid of compiler warn…
Browse files Browse the repository at this point in the history
…ings
  • Loading branch information
Klamath233 committed Sep 21, 2019
1 parent 153f60d commit cbdf177
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 17 deletions.
23 changes: 21 additions & 2 deletions RISCV.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
376CF6911DF38E7000020F20 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0820;
LastUpgradeCheck = 1020;
ORGANIZATIONNAME = Makigumo;
TargetAttributes = {
376CF6991DF38E7000020F20 = {
Expand All @@ -140,10 +140,11 @@
};
buildConfigurationList = 376CF6941DF38E7000020F20 /* Build configuration list for PBXProject "RISCV" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 376CF6901DF38E7000020F20;
productRefGroup = 376CF69B1DF38E7000020F20 /* Products */;
Expand Down Expand Up @@ -216,20 +217,29 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand Down Expand Up @@ -263,20 +273,29 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand Down
2 changes: 1 addition & 1 deletion RISCV.xcodeproj/xcshareddata/xcschemes/RISCV.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0820"
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 1 addition & 1 deletion RISCV.xcodeproj/xcshareddata/xcschemes/RISCVTests.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0820"
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
4 changes: 2 additions & 2 deletions RISCV/RISCVCPU.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ static inline DisasmOperandType getCsrMask() {
return REG_MASK(RegClass_RISCV_CSR, 0);
}

static NSString *getCsrName(uint64_t csr) {
__unused static NSString *getCsrName(uint64_t csr) {
switch (csr) {
case 0x000: return @"ustatus";
case 0x001: return @"flags";
Expand Down Expand Up @@ -349,7 +349,7 @@ static NSString *getCsrName(uint64_t csr) {
case 0xf14: return @"mhartid";

default:
return [NSString stringWithFormat:@"csr_0x%x", csr];
return [NSString stringWithFormat:@"csr_0x%llx", csr];
}
}

Expand Down
11 changes: 10 additions & 1 deletion RISCV/RISCVCPU.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ + (int)sdkVersion {
return HOPPER_CURRENT_SDK_VERSION;
}

- (HopperUUID *)pluginUUID {
- (NSObject<HPHopperUUID> *)pluginUUID {
return [_services UUIDWithString:@"BB67F523-0244-4FBD-8842-ADFE624FB826"];
}

Expand Down Expand Up @@ -251,4 +251,13 @@ - (BOOL)canDecompileProceduresForCPUFamily:(NSString *)family andSubFamily:(NSSt
return NO;
}

- (int)integerWidthInBitsForCPUFamily:(nullable NSString *)family andSubFamily:(nullable NSString *)subFamily {
if ([family isEqualToString:@"RISCV"]) {
if ([subFamily isEqualToString:@"riscv32"]) return 32;
if ([subFamily isEqualToString:@"riscv64"]) return 64;
}
return 0;
}


@end
18 changes: 9 additions & 9 deletions RISCV/RISCVCtx.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ extern NSString *getCsrName(uint64_t csr);
#define DISASM_OPERAND_ROUNDING_MODE 0x0001000000000000llu
#define DISASM_OPERAND_FENCE 0x0002000000000000llu

typedef enum INSN_TYPE {
enum INSN_TYPE {
ITYPE,
RTYPE,
UTYPE,
Expand All @@ -75,15 +75,15 @@ typedef enum INSN_TYPE {
UJTYPE
};

typedef struct itype_insn {
struct itype_insn {
uint8_t opcode; /* bits 6..0 */
uint8_t reg_dest; /* bits 11..7 */
uint8_t funct3; /* bits 14..12 */
uint8_t reg_src1; /* bits 19..15 */
uint16_t imm; /* bits 31..20 */
};

typedef struct rtype_insn {
struct rtype_insn {
uint8_t opcode; /* bits 6..0 */
uint8_t reg_dest; /* bits 11..7 */
uint8_t funct3; /* bits 14..12 */
Expand All @@ -92,21 +92,21 @@ typedef struct rtype_insn {
uint8_t funct7; /* bits 31..25 */
};

typedef struct stype_insn {
struct stype_insn {
uint8_t opcode; /* bits 6..0 */
uint8_t funct3; /* bits 14..12 */
uint8_t reg_src1; /* bits 19..15 */
uint8_t reg_src2; /* bits 31..20 */
uint16_t imm; /* bits 31..25 11..7 */
};

typedef struct utype_insn {
struct utype_insn {
uint8_t opcode; /* bits 6..0 */
uint8_t reg_dest; /* bits 11..7 */
uint16_t imm; /* bits 31..12 */
};

typedef struct insn {
struct insn {
uint8_t opcode;
enum INSN_TYPE type;
union {
Expand All @@ -117,14 +117,14 @@ typedef struct insn {
};
};

typedef enum FpuFormat {
enum FpuFormat {
FPU_FMT_SINGLE = 0b00,
FPU_FMT_DOUBLE = 0b01,
FPU_FMT_INVALID = 0b10,
FPU_FMT_QUAD = 0b11,
};

typedef enum FpuRoundingMode {
enum FpuRoundingMode {
FPU_RM_RNE = 0b000,
FPU_RM_RTZ = 0b001,
FPU_RM_RDN = 0b010,
Expand Down Expand Up @@ -449,4 +449,4 @@ static inline NSString *getRoundingModeName(enum FpuRoundingMode rm) {
default:
return @"invalid/reserved";
}
}
}
14 changes: 13 additions & 1 deletion RISCV/RISCVCtx.m
Original file line number Diff line number Diff line change
Expand Up @@ -1540,6 +1540,9 @@ - (int)disassembleSingleInstruction:(DisasmStruct *)disasm usingProcessorMode:(N
case FPU_FMT_QUAD:
populateFp_R4(disasm, insncode, "fmadd.q");
break;
case FPU_FMT_INVALID:
/* Break to return DISASM_UNKNOWN_OPCODE */
break;
}
break;

Expand All @@ -1554,6 +1557,9 @@ - (int)disassembleSingleInstruction:(DisasmStruct *)disasm usingProcessorMode:(N
case FPU_FMT_QUAD:
populateFp_R4(disasm, insncode, "fmsub.q");
break;
case FPU_FMT_INVALID:
/* Break to return DISASM_UNKNOWN_OPCODE */
break;
}
break;

Expand All @@ -1568,6 +1574,9 @@ - (int)disassembleSingleInstruction:(DisasmStruct *)disasm usingProcessorMode:(N
case FPU_FMT_QUAD:
populateFp_R4(disasm, insncode, "fnmadd.q");
break;
case FPU_FMT_INVALID:
/* Break to return DISASM_UNKNOWN_OPCODE */
break;
}
break;

Expand All @@ -1582,6 +1591,9 @@ - (int)disassembleSingleInstruction:(DisasmStruct *)disasm usingProcessorMode:(N
case FPU_FMT_QUAD:
populateFp_R4(disasm, insncode, "fnmsub.q");
break;
case FPU_FMT_INVALID:
/* Break to return DISASM_UNKNOWN_OPCODE */
break;
}
break;

Expand Down Expand Up @@ -1800,7 +1812,7 @@ static inline int regIndexFromType(uint64_t type) {
- (void)buildAddress:(DisasmStruct *)disasm
withInsn:(const struct insn *)in {
// fetch previous instruction
uint32_t prev = [_file readUInt32AtVirtualAddress:disasm->virtualAddr - 4];
__unused uint32_t prev = [_file readUInt32AtVirtualAddress:disasm->virtualAddr - 4];
struct insn *prevIn = 0;//getInsn(prev);
if (prevIn && prevIn->opcode == 0b001111 /* LUI */ &&
prevIn->itype.reg_dest == in->itype.reg_src1) {
Expand Down

0 comments on commit cbdf177

Please sign in to comment.