ifndef LBUGPOINT
LBUGPOINT := $(LLVMToolDir)/bugpoint$(EXEEXT)
endif
ifndef LBUGPOINT
LBUGPOINT := $(LLVMToolDir)/bugpoint$(EXEEXT)
endif
+ifndef LUPGRADE
+LUPGRADE := $(LLVMToolDir)/llvm-upgrade$(EXEEXT)
+endif
+ifeq ($(LLVMGCC_MAJVERS),3)
+UPGRADE_MSG = $(Echo) "Upgrading $(1) assembly to latest."
+UPGRADE_LL = $(Verb)$(LUPGRADE) $(1) -o $(1).up.tmp -f ; $(MV) $(1).up.tmp $(1)
+else
+UPGRADE_MSG =
+UPGRADE_LL =
+endif
+
+LLVMGCC_MAJVERS := 4
LLVMGCCWITHPATH := PATH="$(LLVMToolDir):$(PATH)" $(LLVMGCC)
LLVMGXXWITHPATH := PATH="$(LLVMToolDir):$(PATH)" $(LLVMGXX)
LLVMGCCWITHPATH := PATH="$(LLVMToolDir):$(PATH)" $(LLVMGCC)
LLVMGXXWITHPATH := PATH="$(LLVMToolDir):$(PATH)" $(LLVMGXX)
$< -o $@ -S -emit-llvm ; \
then $(MV) -f "$(ObjDir)/$*.BCCXXd" "$(ObjDir)/$*.d"; \
else $(RM) -f "$(ObjDir)/$*.BCCXXd"; exit 1; fi
$< -o $@ -S -emit-llvm ; \
then $(MV) -f "$(ObjDir)/$*.BCCXXd" "$(ObjDir)/$*.d"; \
else $(RM) -f "$(ObjDir)/$*.BCCXXd"; exit 1; fi
+ $(call UPGRADE_MSG,$@)
+ $(call UPGRADE_LL,$@)
$(ObjDir)/%.ll: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
$(Echo) "Compiling $*.cc for $(BuildMode) build (bytecode)"
$(ObjDir)/%.ll: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
$(Echo) "Compiling $*.cc for $(BuildMode) build (bytecode)"
$< -o $@ -S -emit-llvm ; \
then $(MV) -f "$(ObjDir)/$*.BCCXXd" "$(ObjDir)/$*.d"; \
else $(RM) -f "$(ObjDir)/$*.BCCXXd"; exit 1; fi
$< -o $@ -S -emit-llvm ; \
then $(MV) -f "$(ObjDir)/$*.BCCXXd" "$(ObjDir)/$*.d"; \
else $(RM) -f "$(ObjDir)/$*.BCCXXd"; exit 1; fi
+ $(call UPGRADE_MSG,$@)
+ $(call UPGRADE_LL,$@)
$(ObjDir)/%.ll: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
$(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
$(ObjDir)/%.ll: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
$(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
$< -o $@ -S -emit-llvm ; \
then $(MV) -f "$(ObjDir)/$*.BCCd" "$(ObjDir)/$*.d"; \
else $(RM) -f "$(ObjDir)/$*.BCCd"; exit 1; fi
$< -o $@ -S -emit-llvm ; \
then $(MV) -f "$(ObjDir)/$*.BCCd" "$(ObjDir)/$*.d"; \
else $(RM) -f "$(ObjDir)/$*.BCCd"; exit 1; fi
+ $(call UPGRADE_MSG,$@)
+ $(call UPGRADE_LL,$@)
# Provide alternate rule sets if dependencies are disabled
else
# Provide alternate rule sets if dependencies are disabled
else
$(ObjDir)/%.ll: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
$(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
$(BCCompile.CXX) $< -o $@ -S -emit-llvm
$(ObjDir)/%.ll: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
$(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
$(BCCompile.CXX) $< -o $@ -S -emit-llvm
+ $(call UPGRADE_MSG,$@)
+ $(call UPGRADE_LL,$@)
$(ObjDir)/%.ll: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
$(Echo) "Compiling $*.cc for $(BuildMode) build (bytecode)"
$(BCCompile.CXX) $< -o $@ -S -emit-llvm
$(ObjDir)/%.ll: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
$(Echo) "Compiling $*.cc for $(BuildMode) build (bytecode)"
$(BCCompile.CXX) $< -o $@ -S -emit-llvm
+ $(call UPGRADE_MSG,$@)
+ $(call UPGRADE_LL,$@)
$(ObjDir)/%.ll: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
$(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
$(BCCompile.C) $< -o $@ -S -emit-llvm
$(ObjDir)/%.ll: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
$(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
$(BCCompile.C) $< -o $@ -S -emit-llvm
+ $(call UPGRADE_MSG,@)
+ $(call UPGRADE_LL,@)