+/* "Fake" the arguments to the main method */
+void fake_main_args (ir_graph *graph)
+{
+ /* HERE ("start"); */
+
+ entity *ent = get_irg_entity (graph);
+ type *mtp = get_entity_type (ent);
+ ir_node **args = find_irg_args (graph);
+ type *ctp = get_method_param_type (mtp, 1); /* ctp == char[]*[]* */
+ desc_t *arg_desc;
+ pto_t *arg_pto;
+
+ /* 'main' has signature 'void(int, char[]*[]*)' */
+ assert (NULL == args [2]);
+
+ assert (is_Pointer_type (ctp));
+
+ ctp = get_pointer_points_to_type (ctp); /* ctp == char[]*[] */
+
+ assert (is_Array_type (ctp));
+
+ arg_desc = new_name (ctp, args [1], -1);
+ arg_pto = new_pto (args [1]);
+ /* todo: simulate 'store' to arg1[] ?!? */
+ qset_insert (arg_pto->values, arg_desc);
+
+ set_node_pto (args [1], arg_pto);
+
+ DBGPRINT (1, (stdout, "%s:%i (%s[%li])\n",
+ __FUNCTION__, __LINE__,
+ OPNAME (args [1]), OPNUM (args [1])));
+
+# ifdef TEST_MAIN_TYPE
+ ctp = get_array_element_type (ctp); /* ctp == char[]* */
+
+ assert (is_Pointer_type (ctp));
+
+ ctp = get_pointer_points_to_type (ctp); /* ctp == char[] */
+
+ assert (is_Array_type (ctp));
+
+ ctp = get_array_element_type (ctp); /* ctp == char */
+
+ assert (is_primitive_type (ctp));
+# endif /* defined TEST_MAIN_TYPE */
+
+ /* HERE ("end"); */
+}
+
+/* Initialise the Init module */
+void pto_init_init (void)
+{
+ pto_obst = (struct obstack*) xmalloc (sizeof (struct obstack));
+
+ obstack_init (pto_obst);
+}
+
+/* Cleanup the Init module */
+void pto_init_cleanup (void)
+{
+ obstack_free (pto_obst, NULL);
+ memset (pto_obst, 0x00, sizeof (struct obstack));
+ free (pto_obst);
+ pto_obst = NULL;
+}
+
+