Added test case for pbqp construction: There seems to be missing skip patterns, so...
[libfirm] / ir / be / bemain.c
index cb3bbb7..e41b4d9 100644 (file)
@@ -240,10 +240,10 @@ void be_init_default_asm_constraint_flags(void)
        asm_constraint_flags['\r'] = ASM_CONSTRAINT_FLAG_NO_SUPPORT;
 }
 
-asm_constraint_flags_t parse_asm_constraints(const char *constraint)
+asm_constraint_flags_t be_parse_asm_constraints(const char *constraint)
 {
+       asm_constraint_flags_t  flags = 0;
        const char             *c;
-       asm_constraint_flags_t  flags;
        asm_constraint_flags_t  tflags;
 
        for (c = constraint; *c != '\0'; ++c) {
@@ -273,22 +273,35 @@ asm_constraint_flags_t parse_asm_constraints(const char *constraint)
                }
        }
 
-       if ( ((flags & ASM_CONSTRAINT_FLAG_MODIFIER_WRITE)
-                       && (flags & ASM_CONSTRAINT_FLAG_MODIFIER_NO_WRITE))
-               || ((flags & ASM_CONSTRAINT_FLAG_MODIFIER_READ
-                       && (flags & ASM_CONSTRAINT_FLAG_MODIFIER_NO_READ)))) {
+       if ((
+               flags & ASM_CONSTRAINT_FLAG_MODIFIER_WRITE &&
+               flags & ASM_CONSTRAINT_FLAG_MODIFIER_NO_WRITE
+           ) || (
+               flags & ASM_CONSTRAINT_FLAG_MODIFIER_READ &&
+               flags & ASM_CONSTRAINT_FLAG_MODIFIER_NO_READ
+           )) {
                flags |= ASM_CONSTRAINT_FLAG_INVALID;
        }
+       if (!(flags & (ASM_CONSTRAINT_FLAG_MODIFIER_READ     |
+                      ASM_CONSTRAINT_FLAG_MODIFIER_WRITE    |
+                      ASM_CONSTRAINT_FLAG_MODIFIER_NO_WRITE |
+                      ASM_CONSTRAINT_FLAG_MODIFIER_NO_READ)
+           )) {
+               flags |= ASM_CONSTRAINT_FLAG_MODIFIER_READ;
+       }
 
        return flags;
 }
 
-bool is_valid_clobber(const char *clobber)
+int be_is_valid_clobber(const char *clobber)
 {
        /* memory is a valid clobber. (the frontend has to detect this case too,
         * because it has to add memory edges to the asm) */
        if (strcmp(clobber, "memory") == 0)
-               return true;
+               return 1;
+       /* cc (condition code) is always valid */
+       if (strcmp(clobber, "cc") == 0)
+               return 1;
 
        return isa_if->is_valid_clobber(isa_if, clobber);
 }
@@ -359,6 +372,12 @@ void firm_be_init(void)
        be_init_modules();
 }
 
+/* Finalize the Firm backend. */
+void firm_be_finish(void)
+{
+       be_quit_modules();
+}
+
 /* Returns the backend parameter */
 const backend_params *be_get_backend_param(void)
 {
@@ -880,10 +899,10 @@ void be_main(FILE *file_handle, const char *cup_name)
        ir_timer_t *t = NULL;
 
        /* The user specified another config file to read. do that now. */
-       if(strlen(config_file) > 0) {
+       if (config_file[0] != '\0') {
                FILE *f;
 
-               if((f = fopen(config_file, "rt")) != NULL) {
+               if ((f = fopen(config_file, "rt")) != NULL) {
                        lc_opt_from_file(config_file, f, NULL);
                        fclose(f);
                }