diff options
Diffstat (limited to 'source')
| -rw-r--r-- | source/core/common.h | 6 | ||||
| -rw-r--r-- | source/core/core.vcxproj | 1 | ||||
| -rw-r--r-- | source/core/core.vcxproj.filters | 3 | ||||
| -rw-r--r-- | source/core/slang-byte-encode-util.h | 2 | ||||
| -rw-r--r-- | source/core/slang-cpu-defines.h | 102 | ||||
| -rw-r--r-- | source/core/smart-pointer.h | 4 | ||||
| -rw-r--r-- | source/slang/ir.cpp | 3 | ||||
| -rw-r--r-- | source/slang/mangle.cpp | 4 | ||||
| -rw-r--r-- | source/slang/reflection.h | 8 | ||||
| -rw-r--r-- | source/slang/type-layout.h | 3 |
10 files changed, 8 insertions, 128 deletions
diff --git a/source/core/common.h b/source/core/common.h index 5aa7b7737..ba7cd9836 100644 --- a/source/core/common.h +++ b/source/core/common.h @@ -1,6 +1,8 @@ #ifndef CORE_LIB_COMMON_H #define CORE_LIB_COMMON_H +#include "../../slang.h" + #include <cstdint> #ifdef __GNUC__ @@ -19,6 +21,10 @@ namespace Slang typedef int64_t Int64; typedef uint64_t UInt64; + // Define + typedef SlangUInt UInt; + typedef SlangInt Int; + // typedef unsigned short Word; typedef intptr_t PtrInt; diff --git a/source/core/core.vcxproj b/source/core/core.vcxproj index b89e2acff..4b730f028 100644 --- a/source/core/core.vcxproj +++ b/source/core/core.vcxproj @@ -183,7 +183,6 @@ <ClInclude Include="platform.h" /> <ClInclude Include="secure-crt.h" /> <ClInclude Include="slang-byte-encode-util.h" /> - <ClInclude Include="slang-cpu-defines.h" /> <ClInclude Include="slang-free-list.h" /> <ClInclude Include="slang-io.h" /> <ClInclude Include="slang-math.h" /> diff --git a/source/core/core.vcxproj.filters b/source/core/core.vcxproj.filters index 2faaa7137..e0341df7a 100644 --- a/source/core/core.vcxproj.filters +++ b/source/core/core.vcxproj.filters @@ -48,9 +48,6 @@ <ClInclude Include="slang-byte-encode-util.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="slang-cpu-defines.h"> - <Filter>Header Files</Filter> - </ClInclude> <ClInclude Include="slang-free-list.h"> <Filter>Header Files</Filter> </ClInclude> diff --git a/source/core/slang-byte-encode-util.h b/source/core/slang-byte-encode-util.h index 77ddc2f65..5936cae60 100644 --- a/source/core/slang-byte-encode-util.h +++ b/source/core/slang-byte-encode-util.h @@ -3,8 +3,6 @@ #include "list.h" -#include "slang-cpu-defines.h" - namespace Slang { struct ByteEncodeUtil diff --git a/source/core/slang-cpu-defines.h b/source/core/slang-cpu-defines.h deleted file mode 100644 index 5ad1ecf88..000000000 --- a/source/core/slang-cpu-defines.h +++ /dev/null @@ -1,102 +0,0 @@ -#ifndef SLANG_CPU_DEFINES_H -#define SLANG_CPU_DEFINES_H - -/* Macros for detecting processor */ -#if defined(_M_ARM) || defined(__ARM_EABI__) -// This is special case for nVidia tegra -# define SLANG_PROCESSOR_ARM 1 -#elif defined(__i386__) || defined(_M_IX86) -# define SLANG_PROCESSOR_X86 1 -#elif defined(_M_AMD64) || defined(_M_X64) || defined(__amd64) || defined(__x86_64) -# define SLANG_PROCESSOR_X86_64 1 -#elif defined(_PPC_) || defined(__ppc__) || defined(__POWERPC__) || defined(_M_PPC) -# if defined(__powerpc64__) || defined(__ppc64__) || defined(__PPC64__) || defined(__64BIT__) || defined(_LP64) || defined(__LP64__) -# define SLANG_PROCESSOR_POWER_PC_64 1 -# else -# define SLANG_PROCESSOR_POWER_PC 1 -# endif -#elif defined(__arm__) -# define SLANG_PROCESSOR_ARM 1 -#elif defined(__aarch64__) -# define SLANG_PROCESSOR_ARM_64 1 -#endif - -#ifndef SLANG_PROCESSOR_ARM -# define SLANG_PROCESSOR_ARM 0 -#endif - -#ifndef SLANG_PROCESSOR_ARM_64 -# define SLANG_PROCESSOR_ARM_64 0 -#endif - -#ifndef SLANG_PROCESSOR_X86 -# define SLANG_PROCESSOR_X86 0 -#endif - -#ifndef SLANG_PROCESSOR_X86_64 -# define SLANG_PROCESSOR_X86_64 0 -#endif - -#ifndef SLANG_PROCESSOR_POWER_PC -# define SLANG_PROCESSOR_POWER_PC 0 -#endif - -#ifndef SLANG_PROCESSOR_POWER_PC_64 -# define SLANG_PROCESSOR_POWER_PC_64 0 -#endif - -// Processor families - -#define SLANG_PROCESSOR_FAMILY_X86 (SLANG_PROCESSOR_X86_64 | SLANG_PROCESSOR_X86) -#define SLANG_PROCESSOR_FAMILY_ARM (SLANG_PROCESSOR_ARM | SLANG_PROCESSOR_ARM_64) -#define SLANG_PROCESSOR_FAMILY_POWER_PC (SLANG_PROCESSOR_POWER_PC_64 | SLANG_PROCESSOR_POWER_PC) - -#define SLANG_PTR_IS_64 (SLANG_PROCESSOR_ARM_64 | SLANG_PROCESSOR_X86_64 | SLANG_PROCESSOR_POWER_PC_64) -#define SLANG_PTR_IS_32 (SLANG_PTR_IS_64 ^ 1) - -// TODO: This isn't great. The problem is UInt maps to size_t, and on some targets (like OSX) -// size_t is distinct from any other integral type. So that creates an ambiguity -// Really we want to modify the StringBuilder and elsewhere to handle the case when it is known it can't unambiguously coerce -namespace Slang { -#ifdef SLANG_PTR_IS_64 -typedef UInt64 UnambigousUInt; -typedef Int64 UnambiguousInt; -#else -typedef UInt32 UnambigousUInt; -typedef Int32 UnambiguousInt; -#endif -} // namespace Slang - -// Processor features -#if SLANG_PROCESSOR_FAMILY_X86 -# define SLANG_LITTLE_ENDIAN 1 -# define SLANG_UNALIGNED_ACCESS 1 -#elif SLANG_PROCESSOR_FAMILY_ARM -# if defined(__ARMEB__) -# define SLANG_BIG_ENDIAN 1 -# else -# define SLANG_LITTLE_ENDIAN 1 -# endif -#elif SLANG_PROCESSOR_FAMILY_POWER_PC -# define SLANG_BIG_ENDIAN 1 -#endif - -#ifndef SLANG_LITTLE_ENDIAN -# define SLANG_LITTLE_ENDIAN 0 -#endif - -#ifndef SLANG_BIG_ENDIAN -# define SLANG_BIG_ENDIAN 0 -#endif - -#ifndef SLANG_UNALIGNED_ACCESS -# define SLANG_UNALIGNED_ACCESS 0 -#endif - -// One endianess must be set -#if ((SLANG_BIG_ENDIAN | SLANG_LITTLE_ENDIAN) == 0) -# error "Couldn't determine endianess" -#endif - - -#endif // SLANG_CPU_DEFINES_H
\ No newline at end of file diff --git a/source/core/smart-pointer.h b/source/core/smart-pointer.h index 0b03deb8f..8ce67e384 100644 --- a/source/core/smart-pointer.h +++ b/source/core/smart-pointer.h @@ -11,10 +11,6 @@ namespace Slang { - // TODO: Need to centralize these typedefs - typedef uintptr_t UInt; - typedef intptr_t Int; - // Base class for all reference-counted objects class RefObject { diff --git a/source/slang/ir.cpp b/source/slang/ir.cpp index 3f6f8e0a3..43ec09abb 100644 --- a/source/slang/ir.cpp +++ b/source/slang/ir.cpp @@ -3,7 +3,6 @@ #include "ir-insts.h" #include "../core/basic.h" -#include "../core/slang-cpu-defines.h" #include "mangle.h" @@ -3008,7 +3007,7 @@ namespace Slang IRDumpContext* context, UInt val) { - context->builder->append(UnambigousUInt(val)); + context->builder->append(val); } */ diff --git a/source/slang/mangle.cpp b/source/slang/mangle.cpp index a61e4e666..61fa709b1 100644 --- a/source/slang/mangle.cpp +++ b/source/slang/mangle.cpp @@ -3,8 +3,6 @@ #include "name.h" #include "syntax.h" -#include "../core/slang-cpu-defines.h" - namespace Slang { struct ManglingContext @@ -23,7 +21,7 @@ namespace Slang ManglingContext* context, UInt value) { - context->sb.append(UnambigousUInt(value)); + context->sb.append(value); } void emit( diff --git a/source/slang/reflection.h b/source/slang/reflection.h index 6c0b39564..09f02d8dd 100644 --- a/source/slang/reflection.h +++ b/source/slang/reflection.h @@ -8,14 +8,6 @@ namespace Slang { -// TODO(tfoley): Need to move these somewhere universal - -typedef intptr_t Int; -typedef int64_t Int64; - -typedef uintptr_t UInt; -typedef uint64_t UInt64; - class ProgramLayout; class TypeLayout; diff --git a/source/slang/type-layout.h b/source/slang/type-layout.h index 5ac9229b4..f0c09f371 100644 --- a/source/slang/type-layout.h +++ b/source/slang/type-layout.h @@ -10,9 +10,6 @@ namespace Slang { -typedef intptr_t Int; -typedef uintptr_t UInt; - // Forward declarations enum class BaseType; |
