[NDS32] Consider TARGET_CMODEL_LARGE for function call instructions.

gcc/
	* config/nds32/nds32.md (call): Use pseudo instruction bal which
	clobbers TA_REGNUM if large code model is specified.
	(call_register): Likewise.
	(call_immediate): Likewise.
	(call_value): Likewise.
	(call_value_register): Likewise.
	(call_value_immediate): Likewise.

From-SVN: r219512
This commit is contained in:
Chung-Ju Wu 2015-01-13 05:37:07 +00:00 committed by Chung-Ju Wu
parent 77b7a1ca23
commit 1f7b80289a
2 changed files with 42 additions and 10 deletions

View File

@ -1,3 +1,13 @@
2015-01-13 Chung-Ju Wu <jasonwucj@gmail.com>
* config/nds32/nds32.md (call): Use pseudo instruction bal which
clobbers TA_REGNUM if large code model is specified.
(call_register): Likewise.
(call_immediate): Likewise.
(call_value): Likewise.
(call_value_register): Likewise.
(call_value_immediate): Likewise.
2015-01-13 Chung-Ju Wu <jasonwucj@gmail.com> 2015-01-13 Chung-Ju Wu <jasonwucj@gmail.com>
* config/nds32/nds32.h (TARGET_CMODEL_SMALL): New macro. * config/nds32/nds32.h (TARGET_CMODEL_SMALL): New macro.

View File

@ -1902,7 +1902,8 @@ create_template:
(define_expand "call" (define_expand "call"
[(parallel [(call (match_operand 0 "memory_operand" "") [(parallel [(call (match_operand 0 "memory_operand" "")
(match_operand 1)) (match_operand 1))
(clobber (reg:SI LP_REGNUM))])] (clobber (reg:SI LP_REGNUM))
(clobber (reg:SI TA_REGNUM))])]
"" ""
"" ""
) )
@ -1910,7 +1911,8 @@ create_template:
(define_insn "*call_register" (define_insn "*call_register"
[(parallel [(call (mem (match_operand:SI 0 "register_operand" "r, r")) [(parallel [(call (mem (match_operand:SI 0 "register_operand" "r, r"))
(match_operand 1)) (match_operand 1))
(clobber (reg:SI LP_REGNUM))])] (clobber (reg:SI LP_REGNUM))
(clobber (reg:SI TA_REGNUM))])]
"" ""
"@ "@
jral5\t%0 jral5\t%0
@ -1921,11 +1923,20 @@ create_template:
(define_insn "*call_immediate" (define_insn "*call_immediate"
[(parallel [(call (mem (match_operand:SI 0 "immediate_operand" "i")) [(parallel [(call (mem (match_operand:SI 0 "immediate_operand" "i"))
(match_operand 1)) (match_operand 1))
(clobber (reg:SI LP_REGNUM))])] (clobber (reg:SI LP_REGNUM))
(clobber (reg:SI TA_REGNUM))])]
"" ""
"jal\t%0" {
if (TARGET_CMODEL_LARGE)
return "bal\t%0";
else
return "jal\t%0";
}
[(set_attr "type" "branch") [(set_attr "type" "branch")
(set_attr "length" "4")]) (set (attr "length")
(if_then_else (match_test "TARGET_CMODEL_LARGE")
(const_int 12)
(const_int 4)))])
;; Subroutine call instruction returning a value. ;; Subroutine call instruction returning a value.
@ -1938,7 +1949,8 @@ create_template:
[(parallel [(set (match_operand 0) [(parallel [(set (match_operand 0)
(call (match_operand 1 "memory_operand" "") (call (match_operand 1 "memory_operand" "")
(match_operand 2))) (match_operand 2)))
(clobber (reg:SI LP_REGNUM))])] (clobber (reg:SI LP_REGNUM))
(clobber (reg:SI TA_REGNUM))])]
"" ""
"" ""
) )
@ -1947,7 +1959,8 @@ create_template:
[(parallel [(set (match_operand 0) [(parallel [(set (match_operand 0)
(call (mem (match_operand:SI 1 "register_operand" "r, r")) (call (mem (match_operand:SI 1 "register_operand" "r, r"))
(match_operand 2))) (match_operand 2)))
(clobber (reg:SI LP_REGNUM))])] (clobber (reg:SI LP_REGNUM))
(clobber (reg:SI TA_REGNUM))])]
"" ""
"@ "@
jral5\t%1 jral5\t%1
@ -1959,11 +1972,20 @@ create_template:
[(parallel [(set (match_operand 0) [(parallel [(set (match_operand 0)
(call (mem (match_operand:SI 1 "immediate_operand" "i")) (call (mem (match_operand:SI 1 "immediate_operand" "i"))
(match_operand 2))) (match_operand 2)))
(clobber (reg:SI LP_REGNUM))])] (clobber (reg:SI LP_REGNUM))
(clobber (reg:SI TA_REGNUM))])]
"" ""
"jal\t%1" {
if (TARGET_CMODEL_LARGE)
return "bal\t%1";
else
return "jal\t%1";
}
[(set_attr "type" "branch") [(set_attr "type" "branch")
(set_attr "length" "4")]) (set (attr "length")
(if_then_else (match_test "TARGET_CMODEL_LARGE")
(const_int 12)
(const_int 4)))])
;; prologue and epilogue. ;; prologue and epilogue.