x86: rename X86_COMPACT to X86_REDUCE. suggested by Pancake
diff --git a/Makefile b/Makefile
index 7c2cfc8..2fc9cc3 100644
--- a/Makefile
+++ b/Makefile
@@ -157,17 +157,17 @@
# by default, we compile full X86 instruction sets
-X86_COMPACT =
-ifneq (,$(findstring yes,$(CAPSTONE_X86_COMPACT)))
-X86_COMPACT = _compact
-CFLAGS += -DCAPSTONE_X86_COMPACT
+X86_REDUCE =
+ifneq (,$(findstring yes,$(CAPSTONE_X86_REDUCE)))
+X86_REDUCE = _reduce
+CFLAGS += -DCAPSTONE_X86_REDUCE
endif
DEP_X86 =
-DEP_X86 += arch/X86/X86GenAsmWriter$(X86_COMPACT).inc
-DEP_X86 += arch/X86/X86GenAsmWriter1$(X86_COMPACT).inc
-DEP_X86 += arch/X86/X86GenDisassemblerTables$(X86_COMPACT).inc
-DEP_X86 += arch/X86/X86GenInstrInfo$(X86_COMPACT).inc
+DEP_X86 += arch/X86/X86GenAsmWriter$(X86_REDUCE).inc
+DEP_X86 += arch/X86/X86GenAsmWriter1$(X86_REDUCE).inc
+DEP_X86 += arch/X86/X86GenDisassemblerTables$(X86_REDUCE).inc
+DEP_X86 += arch/X86/X86GenInstrInfo$(X86_REDUCE).inc
DEP_X86 += arch/X86/X86GenRegisterInfo.inc
LIBOBJ_X86 =
diff --git a/arch/X86/X86ATTInstPrinter.c b/arch/X86/X86ATTInstPrinter.c
index c1d138c..5e9c62d 100644
--- a/arch/X86/X86ATTInstPrinter.c
+++ b/arch/X86/X86ATTInstPrinter.c
@@ -69,7 +69,7 @@
printMemReference(MI, OpNo, O);
}
-#ifndef CAPSTONE_X86_COMPACT
+#ifndef CAPSTONE_X86_REDUCE
static void printi256mem(MCInst *MI, unsigned OpNo, SStream *O)
{
SStream_concat(O, "ymmword ptr ");
@@ -482,8 +482,8 @@
#include "X86InstPrinter.h"
#define GET_INSTRINFO_ENUM
-#ifdef CAPSTONE_X86_COMPACT
-#include "X86GenInstrInfo_compact.inc"
+#ifdef CAPSTONE_X86_REDUCE
+#include "X86GenInstrInfo_reduce.inc"
#else
#include "X86GenInstrInfo.inc"
#endif
@@ -493,8 +493,8 @@
// Include the auto-generated portion of the assembly writer.
#define PRINT_ALIAS_INSTR
-#ifdef CAPSTONE_X86_COMPACT
-#include "X86GenAsmWriter_compact.inc"
+#ifdef CAPSTONE_X86_REDUCE
+#include "X86GenAsmWriter_reduce.inc"
#else
#include "X86GenAsmWriter.inc"
#endif
diff --git a/arch/X86/X86Disassembler.c b/arch/X86/X86Disassembler.c
index 8717ce3..25c738e 100644
--- a/arch/X86/X86Disassembler.c
+++ b/arch/X86/X86Disassembler.c
@@ -32,8 +32,8 @@
#include "X86GenRegisterInfo.inc"
#define GET_INSTRINFO_ENUM
-#ifdef CAPSTONE_X86_COMPACT
-#include "X86GenInstrInfo_compact.inc"
+#ifdef CAPSTONE_X86_REDUCE
+#include "X86GenInstrInfo_reduce.inc"
#else
#include "X86GenInstrInfo.inc"
#endif
@@ -186,7 +186,7 @@
// Special case those X86 instructions that use the imm8 as a set of
// bits, bit count, etc. and are not sign-extend.
if (
-#ifndef CAPSTONE_X86_COMPACT
+#ifndef CAPSTONE_X86_REDUCE
Opcode != X86_BLENDPSrri &&
Opcode != X86_BLENDPDrri &&
Opcode != X86_PBLENDWrri &&
@@ -321,7 +321,7 @@
MCOperand *displacement;
MCOperand *segmentReg;
bool IndexIs512;
-#ifndef CAPSTONE_X86_COMPACT
+#ifndef CAPSTONE_X86_REDUCE
uint32_t Opcode;
#endif
@@ -347,11 +347,11 @@
// I don't see a way to get the correct IndexReg in readSIB:
// We can tell whether it is VSIB or SIB after instruction ID is decoded,
// but instruction ID may not be decoded yet when calling readSIB.
-#ifndef CAPSTONE_X86_COMPACT
+#ifndef CAPSTONE_X86_REDUCE
Opcode = MCInst_getOpcode(mcInst);
#endif
bool IndexIs128 = (
-#ifndef CAPSTONE_X86_COMPACT
+#ifndef CAPSTONE_X86_REDUCE
Opcode == X86_VGATHERDPDrm ||
Opcode == X86_VGATHERDPDYrm ||
Opcode == X86_VGATHERQPDrm ||
@@ -366,7 +366,7 @@
false
);
bool IndexIs256 = (
-#ifndef CAPSTONE_X86_COMPACT
+#ifndef CAPSTONE_X86_REDUCE
Opcode == X86_VGATHERQPDYrm ||
Opcode == X86_VGATHERDPSYrm ||
Opcode == X86_VGATHERQPSYrm ||
@@ -379,7 +379,7 @@
false
);
IndexIs512 = (
-#ifndef CAPSTONE_X86_COMPACT
+#ifndef CAPSTONE_X86_REDUCE
Opcode == X86_VGATHERQPDZrm ||
Opcode == X86_VGATHERDPSZrm ||
Opcode == X86_VGATHERQPSZrm ||
@@ -648,7 +648,7 @@
// If when reading the prefix bytes we determined the overlapping 0xf2 or 0xf3
// prefix bytes should be disassembled as xrelease and xacquire then set the
// opcode to those instead of the rep and repne opcodes.
-#ifndef CAPSTONE_X86_COMPACT
+#ifndef CAPSTONE_X86_REDUCE
if (insn->xAcquireRelease) {
if (MCInst_getOpcode(mcInst) == X86_REP_PREFIX)
MCInst_setOpcode(mcInst, X86_XRELEASE_PREFIX);
diff --git a/arch/X86/X86DisassemblerDecoder.c b/arch/X86/X86DisassemblerDecoder.c
index ea905ee..852ad9c 100644
--- a/arch/X86/X86DisassemblerDecoder.c
+++ b/arch/X86/X86DisassemblerDecoder.c
@@ -24,16 +24,16 @@
#include "X86DisassemblerDecoder.h"
-#ifdef CAPSTONE_X86_COMPACT
-#include "X86GenDisassemblerTables_compact.inc"
+#ifdef CAPSTONE_X86_REDUCE
+#include "X86GenDisassemblerTables_reduce.inc"
#else
#include "X86GenDisassemblerTables.inc"
#endif
//#define GET_INSTRINFO_ENUM
#define GET_INSTRINFO_MC_DESC
-#ifdef CAPSTONE_X86_COMPACT
-#include "X86GenInstrInfo_compact.inc"
+#ifdef CAPSTONE_X86_REDUCE
+#include "X86GenInstrInfo_reduce.inc"
#else
#include "X86GenInstrInfo.inc"
#endif
@@ -104,7 +104,7 @@
decision = THREEBYTE3A_SYM;
indextable = index_x86DisassemblerThreeByte3AOpcodes;
break;
-#ifndef CAPSTONE_X86_COMPACT
+#ifndef CAPSTONE_X86_REDUCE
case XOP8_MAP:
decision = XOP8_MAP_SYM;
indextable = index_x86DisassemblerXOP8Opcodes;
@@ -181,7 +181,7 @@
else
dec = &emptyTable.modRMDecisions[opcode];
break;
-#ifndef CAPSTONE_X86_COMPACT
+#ifndef CAPSTONE_X86_REDUCE
case XOP8_MAP:
indextable = index_x86DisassemblerXOP8Opcodes;
index = indextable[insnContext];
diff --git a/arch/X86/X86GenAsmWriter1_compact.inc b/arch/X86/X86GenAsmWriter1_reduce.inc
similarity index 100%
rename from arch/X86/X86GenAsmWriter1_compact.inc
rename to arch/X86/X86GenAsmWriter1_reduce.inc
diff --git a/arch/X86/X86GenAsmWriter_compact.inc b/arch/X86/X86GenAsmWriter_reduce.inc
similarity index 100%
rename from arch/X86/X86GenAsmWriter_compact.inc
rename to arch/X86/X86GenAsmWriter_reduce.inc
diff --git a/arch/X86/X86GenDisassemblerTables_compact.inc b/arch/X86/X86GenDisassemblerTables_reduce.inc
similarity index 100%
rename from arch/X86/X86GenDisassemblerTables_compact.inc
rename to arch/X86/X86GenDisassemblerTables_reduce.inc
diff --git a/arch/X86/X86GenInstrInfo_compact.inc b/arch/X86/X86GenInstrInfo_reduce.inc
similarity index 100%
rename from arch/X86/X86GenInstrInfo_compact.inc
rename to arch/X86/X86GenInstrInfo_reduce.inc
diff --git a/arch/X86/X86IntelInstPrinter.c b/arch/X86/X86IntelInstPrinter.c
index 9b7d433..c00d5d0 100644
--- a/arch/X86/X86IntelInstPrinter.c
+++ b/arch/X86/X86IntelInstPrinter.c
@@ -67,7 +67,7 @@
printMemReference(MI, OpNo, O);
}
-#ifndef CAPSTONE_X86_COMPACT
+#ifndef CAPSTONE_X86_REDUCE
static void printi256mem(MCInst *MI, unsigned OpNo, SStream *O)
{
SStream_concat(O, "ymmword ptr ");
@@ -530,15 +530,15 @@
}
#define GET_INSTRINFO_ENUM
-#ifdef CAPSTONE_X86_COMPACT
-#include "X86GenInstrInfo_compact.inc"
+#ifdef CAPSTONE_X86_REDUCE
+#include "X86GenInstrInfo_reduce.inc"
#else
#include "X86GenInstrInfo.inc"
#endif
#define PRINT_ALIAS_INSTR
-#ifdef CAPSTONE_X86_COMPACT
-#include "X86GenAsmWriter1_compact.inc"
+#ifdef CAPSTONE_X86_REDUCE
+#include "X86GenAsmWriter1_reduce.inc"
#else
#include "X86GenAsmWriter1.inc"
#endif
diff --git a/arch/X86/X86Mapping.c b/arch/X86/X86Mapping.c
index cee2299..ee85347 100644
--- a/arch/X86/X86Mapping.c
+++ b/arch/X86/X86Mapping.c
@@ -1616,13 +1616,13 @@
}
#define GET_INSTRINFO_ENUM
-#ifdef CAPSTONE_X86_COMPACT
-#include "X86GenInstrInfo_compact.inc"
+#ifdef CAPSTONE_X86_REDUCE
+#include "X86GenInstrInfo_reduce.inc"
#else
#include "X86GenInstrInfo.inc"
#endif
-#ifndef CAPSTONE_X86_COMPACT
+#ifndef CAPSTONE_X86_REDUCE
static insn_map insns[] = {
// dummy item
{
@@ -40777,7 +40777,7 @@
{ X86_CMP16i16, X86_REG_AX },
{ X86_ADC32i32, X86_REG_EAX },
{ X86_IN32ri, X86_REG_EAX },
-#ifndef CAPSTONE_X86_COMPACT
+#ifndef CAPSTONE_X86_REDUCE
{ X86_SKINIT, X86_REG_EAX },
{ X86_INVLPGA32, X86_REG_EAX },
{ X86_VMRUN32, X86_REG_EAX },
diff --git a/bindings/python/capstone/__init__.py b/bindings/python/capstone/__init__.py
index 2a9e651..1e1dbe3 100644
--- a/bindings/python/capstone/__init__.py
+++ b/bindings/python/capstone/__init__.py
@@ -1 +1 @@
-from capstone import Cs, CsError, cs_disasm_quick, cs_disasm_lite, cs_version, cs_support, version_bind, debug, CS_API_MAJOR, CS_API_MINOR, CS_ARCH_ARM, CS_ARCH_ARM64, CS_ARCH_MIPS, CS_ARCH_X86, CS_ARCH_PPC, CS_ARCH_SPARC, CS_ARCH_SYSZ, CS_ARCH_ALL, CS_MODE_LITTLE_ENDIAN, CS_MODE_ARM, CS_MODE_THUMB, CS_OPT_SYNTAX, CS_OPT_SYNTAX_DEFAULT, CS_OPT_SYNTAX_INTEL, CS_OPT_SYNTAX_ATT, CS_OPT_SYNTAX_NOREGNAME, CS_OPT_DETAIL, CS_OPT_ON, CS_OPT_OFF, CS_MODE_16, CS_MODE_32, CS_MODE_64, CS_MODE_BIG_ENDIAN, CS_MODE_MICRO, CS_MODE_N64, CS_MODE_V9, CS_SUPPORT_DIET, CS_SUPPORT_X86_COMPACT
+from capstone import Cs, CsError, cs_disasm_quick, cs_disasm_lite, cs_version, cs_support, version_bind, debug, CS_API_MAJOR, CS_API_MINOR, CS_ARCH_ARM, CS_ARCH_ARM64, CS_ARCH_MIPS, CS_ARCH_X86, CS_ARCH_PPC, CS_ARCH_SPARC, CS_ARCH_SYSZ, CS_ARCH_ALL, CS_MODE_LITTLE_ENDIAN, CS_MODE_ARM, CS_MODE_THUMB, CS_OPT_SYNTAX, CS_OPT_SYNTAX_DEFAULT, CS_OPT_SYNTAX_INTEL, CS_OPT_SYNTAX_ATT, CS_OPT_SYNTAX_NOREGNAME, CS_OPT_DETAIL, CS_OPT_ON, CS_OPT_OFF, CS_MODE_16, CS_MODE_32, CS_MODE_64, CS_MODE_BIG_ENDIAN, CS_MODE_MICRO, CS_MODE_N64, CS_MODE_V9, CS_SUPPORT_DIET, CS_SUPPORT_X86_REDUCE
diff --git a/bindings/python/capstone/capstone.py b/bindings/python/capstone/capstone.py
index c0a40ef..1f63e09 100644
--- a/bindings/python/capstone/capstone.py
+++ b/bindings/python/capstone/capstone.py
@@ -58,7 +58,7 @@
'CS_ERR_DIET',
'CS_SUPPORT_DIET',
- 'CS_SUPPORT_X86_COMPACT',
+ 'CS_SUPPORT_X86_REDUCE',
]
# Capstone C interface
@@ -120,7 +120,7 @@
# query id for cs_support()
CS_SUPPORT_DIET = CS_ARCH_ALL+1
-CS_SUPPORT_X86_COMPACT = CS_ARCH_ALL+2
+CS_SUPPORT_X86_REDUCE = CS_ARCH_ALL+2
import ctypes, ctypes.util, sys
from os.path import split, join, dirname
@@ -547,7 +547,7 @@
self._detail = False # by default, do not produce instruction details
self._diet = cs_support(CS_SUPPORT_DIET)
- self._x86_compact = cs_support(CS_SUPPORT_X86_COMPACT)
+ self._x86_compact = cs_support(CS_SUPPORT_X86_REDUCE)
# destructor to be called automatically when object is destroyed.
@@ -698,7 +698,7 @@
if cs_support(CS_ARCH_X86):
all_archs += "-x86"
- if cs_support(CS_SUPPORT_X86_COMPACT):
+ if cs_support(CS_SUPPORT_X86_REDUCE):
all_archs += "_compact"
(major, minor, _combined) = cs_version()
diff --git a/bindings/python/pyx/ccapstone.pyx b/bindings/python/pyx/ccapstone.pyx
index 13b3fd0..df7adee 100644
--- a/bindings/python/pyx/ccapstone.pyx
+++ b/bindings/python/pyx/ccapstone.pyx
@@ -286,7 +286,7 @@
if cs_support(CS_ARCH_X86):
all_archs += "-x86"
- if cs_support(CS_SUPPORT_X86_COMPACT):
+ if cs_support(CS_SUPPORT_X86_REDUCE):
all_archs += "_compact"
(major, minor, _combined) = capstone.cs_version()
diff --git a/config.mk b/config.mk
index 25745a5..0b185a7 100644
--- a/config.mk
+++ b/config.mk
@@ -54,7 +54,7 @@
################################################################################
-# Change 'CAPSTONE_X86_COMPACT = no' to 'CAPSTONE_X86_COMPACT = yes' to remove
+# Change 'CAPSTONE_X86_REDUCE = no' to 'CAPSTONE_X86_REDUCE = yes' to remove
# non-critical instruction sets of X86, making the binary size smaller by ~50%.
# This is desired in special cases, such as OS kernel, where these kind of
# instructions are not used.
@@ -72,7 +72,7 @@
#
# Due to this removal, the related instructions are nolonger supported.
#
-# By default, Capstone is compiled with 'CAPSTONE_X86_COMPACT = no',
+# By default, Capstone is compiled with 'CAPSTONE_X86_REDUCE = no',
# thus supports complete X86 instructions.
-CAPSTONE_X86_COMPACT = no
+CAPSTONE_X86_REDUCE = yes
diff --git a/cs.c b/cs.c
index d1df809..3024508 100644
--- a/cs.c
+++ b/cs.c
@@ -110,8 +110,8 @@
#endif
}
- if (query == CS_SUPPORT_X86_COMPACT) {
-#if defined(CAPSTONE_HAS_X86) && defined(CAPSTONE_X86_COMPACT)
+ if (query == CS_SUPPORT_X86_REDUCE) {
+#if defined(CAPSTONE_HAS_X86) && defined(CAPSTONE_X86_REDUCE)
return true;
#else
return false;
diff --git a/include/capstone.h b/include/capstone.h
index cf890c7..f093276 100644
--- a/include/capstone.h
+++ b/include/capstone.h
@@ -51,9 +51,9 @@
#define CS_SUPPORT_DIET (CS_ARCH_ALL + 1)
// Support value to verify X86 compact mode of the engine.
-// If cs_support(CS_SUPPORT_X86_COMPACT) return True, the engine was compiled
+// If cs_support(CS_SUPPORT_X86_REDUCE) return True, the engine was compiled
// in X86 compact mode.
-#define CS_SUPPORT_X86_COMPACT (CS_ARCH_ALL + 2)
+#define CS_SUPPORT_X86_REDUCE (CS_ARCH_ALL + 2)
// Mode type
typedef enum cs_mode {