odin-blend2d

Odin bindings to Blend2D
Log | Files | Refs | README | LICENSE

asmjit_test_runner.cpp (4303B)


      1 // This file is part of AsmJit project <https://asmjit.com>
      2 //
      3 // See <asmjit/core.h> or LICENSE.md for license and copyright information
      4 // SPDX-License-Identifier: Zlib
      5 
      6 #include <asmjit/core.h>
      7 
      8 #if !defined(ASMJIT_NO_X86)
      9   #include <asmjit/x86.h>
     10 #endif
     11 
     12 #if !defined(ASMJIT_NO_AARCH64)
     13   #include <asmjit/a64.h>
     14 #endif
     15 
     16 #include "broken.h"
     17 #include "../commons/asmjitutils.h"
     18 
     19 #if !defined(ASMJIT_NO_COMPILER)
     20 #include <asmjit/core/racfgblock_p.h>
     21 #include <asmjit/core/rainst_p.h>
     22 #include <asmjit/core/rapass_p.h>
     23 #endif
     24 
     25 using namespace asmjit;
     26 
     27 #define DUMP_TYPE(...) \
     28   printf("  %-26s: %u\n", #__VA_ARGS__, uint32_t(sizeof(__VA_ARGS__)))
     29 
     30 static void print_type_sizes(void) noexcept {
     31   printf("Size of C++ types:\n");
     32     DUMP_TYPE(int8_t);
     33     DUMP_TYPE(int16_t);
     34     DUMP_TYPE(int32_t);
     35     DUMP_TYPE(int64_t);
     36     DUMP_TYPE(int);
     37     DUMP_TYPE(long);
     38     DUMP_TYPE(size_t);
     39     DUMP_TYPE(intptr_t);
     40     DUMP_TYPE(float);
     41     DUMP_TYPE(double);
     42     DUMP_TYPE(void*);
     43   printf("\n");
     44 
     45   printf("Size of base classes:\n");
     46     DUMP_TYPE(BaseAssembler);
     47     DUMP_TYPE(BaseEmitter);
     48     DUMP_TYPE(CodeBuffer);
     49     DUMP_TYPE(CodeHolder);
     50     DUMP_TYPE(ConstPool);
     51     DUMP_TYPE(Fixup);
     52     DUMP_TYPE(LabelEntry);
     53     DUMP_TYPE(LabelEntry::ExtraData);
     54     DUMP_TYPE(RelocEntry);
     55     DUMP_TYPE(Section);
     56     DUMP_TYPE(String);
     57     DUMP_TYPE(Target);
     58   printf("\n");
     59 
     60   printf("Size of arena classes:\n");
     61     DUMP_TYPE(Arena);
     62     DUMP_TYPE(ArenaHashNode);
     63     DUMP_TYPE(ArenaHash<ArenaHashNode>);
     64     DUMP_TYPE(ArenaList<int>);
     65     DUMP_TYPE(ArenaVector<int>);
     66     DUMP_TYPE(ArenaString<16>);
     67   printf("\n");
     68 
     69   printf("Size of operand classes:\n");
     70     DUMP_TYPE(Operand);
     71     DUMP_TYPE(Reg);
     72     DUMP_TYPE(BaseMem);
     73     DUMP_TYPE(Imm);
     74     DUMP_TYPE(Label);
     75   printf("\n");
     76 
     77   printf("Size of function classes:\n");
     78     DUMP_TYPE(CallConv);
     79     DUMP_TYPE(FuncFrame);
     80     DUMP_TYPE(FuncValue);
     81     DUMP_TYPE(FuncDetail);
     82     DUMP_TYPE(FuncSignature);
     83     DUMP_TYPE(FuncArgsAssignment);
     84   printf("\n");
     85 
     86 #if !defined(ASMJIT_NO_BUILDER)
     87   constexpr uint32_t kBaseOpCapacity = InstNode::kBaseOpCapacity;
     88   constexpr uint32_t kFullOpCapacity = InstNode::kFullOpCapacity;
     89 
     90   printf("Size of builder classes:\n");
     91     DUMP_TYPE(BaseBuilder);
     92     DUMP_TYPE(BaseNode);
     93     DUMP_TYPE(InstNode);
     94     DUMP_TYPE(InstNodeWithOperands<kBaseOpCapacity>);
     95     DUMP_TYPE(InstNodeWithOperands<kFullOpCapacity>);
     96     DUMP_TYPE(AlignNode);
     97     DUMP_TYPE(LabelNode);
     98     DUMP_TYPE(EmbedDataNode);
     99     DUMP_TYPE(EmbedLabelNode);
    100     DUMP_TYPE(ConstPoolNode);
    101     DUMP_TYPE(CommentNode);
    102     DUMP_TYPE(SentinelNode);
    103   printf("\n");
    104 #endif
    105 
    106 #if !defined(ASMJIT_NO_COMPILER)
    107   printf("Size of compiler classes:\n");
    108     DUMP_TYPE(BaseCompiler);
    109     DUMP_TYPE(FuncNode);
    110     DUMP_TYPE(FuncRetNode);
    111     DUMP_TYPE(InvokeNode);
    112     DUMP_TYPE(VirtReg);
    113   printf("\n");
    114 
    115   printf("Size of compiler classes (RA):\n");
    116     DUMP_TYPE(BaseRAPass);
    117     DUMP_TYPE(RABlock);
    118     DUMP_TYPE(RAInst);
    119     DUMP_TYPE(RATiedReg);
    120     DUMP_TYPE(RAWorkReg);
    121   printf("\n");
    122 #endif
    123 
    124 #if !defined(ASMJIT_NO_X86)
    125   printf("Size of x86-specific classes:\n");
    126     DUMP_TYPE(x86::Assembler);
    127     #if !defined(ASMJIT_NO_BUILDER)
    128     DUMP_TYPE(x86::Builder);
    129     #endif
    130     #if !defined(ASMJIT_NO_COMPILER)
    131     DUMP_TYPE(x86::Compiler);
    132     #endif
    133     DUMP_TYPE(x86::InstDB::InstInfo);
    134     DUMP_TYPE(x86::InstDB::CommonInfo);
    135     DUMP_TYPE(x86::InstDB::OpSignature);
    136     DUMP_TYPE(x86::InstDB::InstSignature);
    137   printf("\n");
    138 #endif
    139 
    140 #if !defined(ASMJIT_NO_AARCH64)
    141   printf("Size of aarch64-specific classes:\n");
    142     DUMP_TYPE(a64::Assembler);
    143     #if !defined(ASMJIT_NO_BUILDER)
    144     DUMP_TYPE(a64::Builder);
    145     #endif
    146     #if !defined(ASMJIT_NO_COMPILER)
    147     DUMP_TYPE(a64::Compiler);
    148     #endif
    149   printf("\n");
    150 #endif
    151 }
    152 
    153 #undef DUMP_TYPE
    154 
    155 static void on_before_run(void) noexcept {
    156   print_build_options();
    157   print_cpu_info();
    158   print_type_sizes();
    159 }
    160 
    161 int main(int argc, const char* argv[]) {
    162   printf("AsmJit Unit-Test v%u.%u.%u [Arch=%s] [Mode=%s]\n\n",
    163     unsigned((ASMJIT_LIBRARY_VERSION >> 16)       ),
    164     unsigned((ASMJIT_LIBRARY_VERSION >>  8) & 0xFF),
    165     unsigned((ASMJIT_LIBRARY_VERSION      ) & 0xFF),
    166     asmjit_arch_as_string(Arch::kHost),
    167     asmjit_build_type()
    168   );
    169 
    170   return BrokenAPI::run(argc, argv, on_before_run);
    171 }