]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Mash around top-level library structure some more.
authorJulian Seward <jseward@acm.org>
Mon, 5 Jul 2004 01:15:34 +0000 (01:15 +0000)
committerJulian Seward <jseward@acm.org>
Mon, 5 Jul 2004 01:15:34 +0000 (01:15 +0000)
git-svn-id: svn://svn.valgrind.org/vex/trunk@48

VEX/Makefile
VEX/priv/host-x86/isel_x86.c
VEX/priv/host-x86/x86h_defs.c
VEX/priv/host-x86/x86h_defs.h
VEX/priv/ir/ir_defs.c
VEX/priv/main/util.h [moved from VEX/pub/basictypes.h with 64% similarity]
VEX/pub/libjit.h [new file with mode: 0644]
VEX/pub/libjit_basictypes.h [new file with mode: 0644]
VEX/pub/libjit_ir.h [moved from VEX/priv/ir/ir_defs.h with 94% similarity]
VEX/test_main.c
VEX/unused/arena.c [moved from VEX/arena.c with 100% similarity]

index 3ac3070606ce363c013c75450d799aa1ecc38c45..b41a3aac147d064661c91a69c26563de8d0bbfa7 100644 (file)
@@ -1,42 +1,39 @@
 
-INCLUDES = include/arena.h                             \
-          include/basictypes.h include/ir_defs.h       \
-          include/host_regs.h include/x86h_defs.h
+PUB_HEADERS =  pub/libjit_basictypes.h                 \
+               pub/libjit_ir.h                         \
+               pub/libjit.h
 
-##OBJS = basictypes.o ir_defs.o arena.o linker.o dispatch.o
-OBJS = basictypes.o ir_defs.o host_regs.o \
-       x86h_defs.o isel_x86.o reg_alloc.o test_main.o
+PRIV_HEADERS =         priv/ir/ir_defs.h                       \
+               priv/host-x86/x86h_defs.h               \
+               priv/host-generic/host_regs.h
 
-GCC = gcc341
-##GCC = gcc
-CC_OPTS = -g -Wall -Wshadow -Iinclude
+LIB_OBJS =     priv/ir/ir_defs.o                       \
+               priv/host-x86/x86h_defs.o               \
+               priv/host-x86/isel_x86.o                \
+               priv/host-generic/host_regs.o           \
+               priv/host-generic/reg_alloc.o
 
-all: $(OBJS)
-       $(GCC) $(CC_OPTS) -o vex $(OBJS)
+PUB_INCLUDES = -Ipub
+
+PRIV_INCLUDES = -Ipub -Ipriv/ir -Ipriv/host-generic -Ipriv/host-x86
+
+APP_OBJS =     test_main.o
+
+
+CC = gcc341
+CCFLAGS = -g -Wall -Wshadow
+
+all: libjit.a $(APP_OBJS)
+       $(CC) $(CCFLAGS) -o vex $(APP_OBJS) libjit.a
+
+libjit.a: $(LIB_OBJS)
+       ar clq libjit.a $(LIB_OBJS)
+
+%.o: %.c
+       $(CC) $(CCFLAGS) $(PRIV_INCLUDES) -c -o $@ $<
 
 clean:
-       rm -f *.o vex
-
-basictypes.o: basictypes.c $(INCLUDES)
-       $(GCC) $(CC_OPTS) -c basictypes.c
-ir_defs.o: ir_defs.c $(INCLUDES)
-       $(GCC) $(CC_OPTS) -c ir_defs.c
-host_regs.o: host_regs.c $(INCLUDES)
-       $(GCC) $(CC_OPTS) -c host_regs.c
-x86h_defs.o: x86h_defs.c $(INCLUDES)
-       $(GCC) $(CC_OPTS) -c x86h_defs.c
-isel_x86.o: isel_x86.c $(INCLUDES)
-       $(GCC) $(CC_OPTS) -c isel_x86.c
-reg_alloc.o: reg_alloc.c $(INCLUDES)
-       $(GCC) $(CC_OPTS) -c reg_alloc.c
-arena.o: arena.c $(INCLUDES)
-       $(GCC) $(CC_OPTS) -c arena.c
-linker.o: linker.c $(INCLUDES)
-       $(GCC) $(CC_OPTS) -c linker.c
-dispatch.o: dispatch.c $(INCLUDES)
-       $(GCC) $(CC_OPTS) -c dispatch.c
-
-test_main.o: test_main.c $(INCLUDES)
-       $(GCC) $(CC_OPTS) -c test_main.c
+       rm -f $(APP_OBJS) $(LIB_OBJS) libjit.a vex
+
 
 
index b62f3f8e7611948a2207b32ef1a7037b0983ad12..ce4f624dbbf499ed9a7c36479461bfcf1d071c49 100644 (file)
@@ -6,10 +6,7 @@
 /*---                                                         ---*/
 /*---------------------------------------------------------------*/
 
-#include <stdio.h>
-#include <malloc.h>
-
-#include "basictypes.h"
+#include "libjit_basictypes.h"
 #include "ir_defs.h"
 #include "host_regs.h"
 #include "x86h_defs.h"
index 170964309fed4e1e277e94e663725a041f6a3350..bf34905dd081add7ee01b9a787c101d6d772a35c 100644 (file)
@@ -6,10 +6,7 @@
 /*---                                                         ---*/
 /*---------------------------------------------------------------*/
 
-#include <stdio.h>
-#include <malloc.h>
-
-#include "basictypes.h"
+#include "libjit_basictypes.h"
 #include "host_regs.h"
 #include "x86h_defs.h"
 
index c1a1021848fe11b77ca6c1a2033d873b0bf9b85d..511f8863dd424565c1ec1e8af0b3b394346a796f 100644 (file)
@@ -6,8 +6,8 @@
 /*---                                                         ---*/
 /*---------------------------------------------------------------*/
 
-#ifndef __X86H_DEFS_H
-#define __X86H_DEFS_H
+#ifndef __LIBJIT_X86H_DEFS_H
+#define __LIBJIT_X86H_DEFS_H
 
 
 /* --------- Registers. --------- */
@@ -231,4 +231,4 @@ extern X86Instr* genSpill_X86         ( HReg rreg, Int offset );
 extern X86Instr* genReload_X86        ( HReg rreg, Int offset );
 
 
-#endif /* ndef __X86H_DEFS_H */
+#endif /* ndef __LIBJIT_X86H_DEFS_H */
index 27ca1abf683f781689b7304f06bfdb0a0ae5d57a..09c79d5376f5ab8f9f3a5e959cf59aacd542e235 100644 (file)
@@ -6,10 +6,7 @@
 /*---                                                         ---*/
 /*---------------------------------------------------------------*/
 
-#include <stdio.h>
-#include <malloc.h>
-
-#include "basictypes.h"
+#include "libjit_basictypes.h"
 #include "ir_defs.h"
 
 
similarity index 64%
rename from VEX/pub/basictypes.h
rename to VEX/priv/main/util.h
index 61d2e187491e101f47d03223c92d0c5cd9d997e3..73eca365df8eef4127f24453bafb30623ba8766d 100644 (file)
@@ -1,29 +1,15 @@
 
 /*---------------------------------------------------------------*/
 /*---                                                         ---*/
-/*--- This file (basictypes.h) is                             ---*/
+/*--- This file (util.h) is                                   ---*/
 /*--- Copyright (c) 2004 OpenWorks LLP.  All rights reserved. ---*/
 /*---                                                         ---*/
 /*---------------------------------------------------------------*/
 
-#ifndef __BASICTYPES_H
-#define __BASICTYPES_H
+#ifndef __LIBJIT_UTIL_H
+#define __LIBJIT_UTIL_H
 
-typedef  unsigned char   UChar;
-typedef           char   Char;        /* platform-dependent signfulness */
-
-typedef  unsigned short  UShort;
-typedef    signed short  Short;
-
-typedef  unsigned int    UInt;
-typedef    signed int    Int;
-
-typedef  unsigned long long int   ULong;
-typedef    signed long long int   Long;
-
-typedef  unsigned char  Bool;
-#define  True   ((Bool)1)
-#define  False  ((Bool)0)
+#include "libjit_basictypes.h"
 
 
 /* Stuff for panicking and assertion. */
@@ -43,4 +29,8 @@ __attribute__ ((__noreturn__))
 extern void panic ( Char* str );
 
 
-#endif /* ndef __BASICTYPES_H */
+#endif /* ndef __LIBJIT_UTIL_H */
+
+/*---------------------------------------------------------------*/
+/*---                                                  util.h ---*/
+/*---------------------------------------------------------------*/
diff --git a/VEX/pub/libjit.h b/VEX/pub/libjit.h
new file mode 100644 (file)
index 0000000..963db9b
--- /dev/null
@@ -0,0 +1,88 @@
+
+/*---------------------------------------------------------------*/
+/*---                                                         ---*/
+/*--- This file (libjit.h) is                                 ---*/
+/*--- Copyright (c) 2004 OpenWorks LLP.  All rights reserved. ---*/
+/*---                                                         ---*/
+/*---------------------------------------------------------------*/
+
+#ifndef __LIBJIT_H
+#define __LIBJIT_H
+
+
+#include "libjit_basictypes.h"
+#include "libjit_ir.h"
+
+
+/*---------------------------------------------------------------*/
+/*--- Top-level interface to the library.                     ---*/
+/*---------------------------------------------------------------*/
+
+
+/* Initialise the translator. */
+
+extern Bool LibJIT_Init (
+   /* failure exit function */
+   void (*failure_exit) ( void ),
+   /* logging output function */
+   void (*log_bytes) ( Char*, Int nbytes ),
+   /* debug paranoia level */
+   Int debuglevel,
+   /* verbosity level */
+   Int verbosity,
+   /* Are we supporting valgrind checking? */
+   Bool valgrind_support,
+   /* Max # guest insns per bb */
+   Int guest_insns_per_bb
+);
+
+
+/* Storage management: clear the area, and allocate from it. */
+
+extern void LibJIT_Clear ( Bool show_stats );
+
+extern void* LibJIT_Alloc ( Int nbytes );
+
+
+/* Translate a basic block. */
+
+typedef 
+   enum { InsnSetX86, InsnSetARM }
+   InsnSet;
+
+typedef
+   enum { TransOK, TransAccessFail, TransOutputFull }
+   TranslateResult;
+
+extern 
+TranslateResult LibJIT_Translate (
+   /* The instruction sets we are translating from and to. */
+   InsnSet iset_guest,
+   InsnSet iset_host,
+   /* IN: the block to translate, and its guest address. */
+   Char*  guest_bytes,
+   Addr64 guest_bytes_addr,
+   /* OUT: the number of bytes actually read */
+   Int* guest_bytes_read,
+   /* IN: a place to put the resulting code, and its size */
+   Char* host_bytes,
+   Int   host_bytes_size,
+   /* OUT: how much of the output area is used. */
+   Int* host_bytes_used,
+   /* IN: optionally, an instrumentation function. */
+   IRBB (*instrument) ( IRBB* ),
+   /* IN: optionally, an access check function for guest code. */
+   Bool (*byte_accessible) ( Addr64 )
+);
+
+
+/* Show accumulated statistics. */
+
+extern void LibJIT_ShowStats ( void );
+
+
+endif /* ndef __LIBJIT_H */
+
+/*---------------------------------------------------------------*/
+/*---                                                libjit.h ---*/
+/*---------------------------------------------------------------*/
diff --git a/VEX/pub/libjit_basictypes.h b/VEX/pub/libjit_basictypes.h
new file mode 100644 (file)
index 0000000..fd4e43e
--- /dev/null
@@ -0,0 +1,34 @@
+
+/*---------------------------------------------------------------*/
+/*---                                                         ---*/
+/*--- This file (libjit_basictypes.h) is                      ---*/
+/*--- Copyright (c) 2004 OpenWorks LLP.  All rights reserved. ---*/
+/*---                                                         ---*/
+/*---------------------------------------------------------------*/
+
+#ifndef __LIBJIT_BASICTYPES_H
+#define __LIBJIT_BASICTYPES_H
+
+typedef  unsigned char   UChar;
+typedef           char   Char;        /* platform-dependent signfulness */
+
+typedef  unsigned short  UShort;
+typedef    signed short  Short;
+
+typedef  unsigned int    UInt;
+typedef    signed int    Int;
+
+typedef  unsigned long long int   ULong;
+typedef    signed long long int   Long;
+
+typedef  unsigned char  Bool;
+#define  True   ((Bool)1)
+#define  False  ((Bool)0)
+
+
+#endif /* ndef __LIBJIT_BASICTYPES_H */
+
+
+/*---------------------------------------------------------------*/
+/*---                                     libjit_basictypes.h ---*/
+/*---------------------------------------------------------------*/
similarity index 94%
rename from VEX/priv/ir/ir_defs.h
rename to VEX/pub/libjit_ir.h
index ae3082cd418393e15a6b2e2d8514b15807b1c960..6421887a0c70cedc1add9aa6569979c1c790eb34 100644 (file)
@@ -1,13 +1,15 @@
 
 /*---------------------------------------------------------------*/
 /*---                                                         ---*/
-/*--- This file (ir_defs.h) is                                ---*/
+/*--- This file (libjit_ir.h) is                              ---*/
 /*--- Copyright (c) 2004 OpenWorks LLP.  All rights reserved. ---*/
 /*---                                                         ---*/
 /*---------------------------------------------------------------*/
 
-#ifndef __IR_DEFS_H
-#define __IR_DEFS_H
+#ifndef __LIBJIT_IR_H
+#define __LIBJIT_IR_H
+
+#include "libjit_basictypes.h"
 
 
 /*---------------------------------------------------------------*/
@@ -265,4 +267,9 @@ extern IRType     lookupIRTypeEnv ( IRTypeEnv*, IRTemp );
 extern IRType typeOfIRExpr ( IRTypeEnv*, IRExpr* );
 
 
-#endif /* ndef __IR_DEFS_H */
+#endif /* ndef __LIBJIT_IR_H */
+
+
+/*---------------------------------------------------------------*/
+/*---                                             libjit_ir.h ---*/
+/*---------------------------------------------------------------*/
index 99a8d7d9a5e7ba70aead46c4bff506111732190a..98db2707b7990497175197cbdb588f392f8a1fe8 100644 (file)
@@ -9,7 +9,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-#include "basictypes.h"
+#include "libjit_basictypes.h"
 #include "ir_defs.h"
 #include "host_regs.h"
 #include "x86h_defs.h"
similarity index 100%
rename from VEX/arena.c
rename to VEX/unused/arena.c