Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
nm_frame.cpp
Go to the documentation of this file.
1#include <stdio.h>
2#define XBYAK_NO_OP_NAMES
3#define XBYAK_ENABLE_OMITTED_OPERAND
4#include "xbyak/xbyak.h"
5
6using namespace Xbyak;
7
8#ifdef _MSC_VER
9 #pragma warning(disable : 4245)
10 #pragma warning(disable : 4312)
11#endif
12class Sample : public CodeGenerator {
13 void operator=(const Sample&);
14public:
15#include "nm.cpp"
16};
17
18#define _STR(x) #x
19#define TEST(syntax) err = true; try { syntax; err = false; } catch (Xbyak::Error) { } catch (...) { } if (!err) printf("should be err:%s;\n", _STR(syntax))
20
21class ErrorSample : public CodeGenerator {
22 void operator=(const ErrorSample&);
23public:
24 void gen()
25 {
26 bool err;
27 TEST(mov(ptr[eax],1));
28 TEST(test(ptr[eax],1));
29 TEST(adc(ptr[eax],1));
30 TEST(setz(eax));
31 }
32};
33int main()
34 try
35{
36 size_t size = sizeof(Xbyak::Operand);
37 if (size != 4) {
38 printf("sizeof Operand %d\n", (int)size);
39 }
40 try {
41 Sample s;
42 s.gen();
43 } catch (std::exception& e) {
44 printf("ERR:%s\n", e.what());
45 } catch (...) {
46 printf("unknown error\n");
47 }
48 ErrorSample es;
49 es.gen();
50} catch (std::exception& e) {
51 printf("err %s\n", e.what());
52 return 1;
53}
void gen()
Definition nm_frame.cpp:24
void setz(const Operand &op)
Definition xbyak.h:716
const Reg32 eax
Definition xbyak.h:2087
void test(const Operand &op, const Reg &reg)
Definition xbyak.h:2162
void adc(const Operand &op, uint32 imm)
Definition xbyak.h:3
void mov(const Operand &reg1, const Operand &reg2)
Definition xbyak.h:2210
const AddressFrame ptr
Definition xbyak.h:2090
LOGGING_API void printf(Category category, const char *format,...)
Definition Logging.cpp:30
Definition xbyak.h:104
#define TEST(syntax)
Definition nm_frame.cpp:19
int main()
Definition nm_frame.cpp:33
Xbyak ; JIT assembler for x86(IA32)/x64 by C++.
char * s