Skip to content

Commit be36d2f

Browse files
committed
Pass Function to Builder::function_call in cg_gcc
1 parent 4f4812f commit be36d2f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

compiler/rustc_codegen_gcc/src/builder.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -316,12 +316,10 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
316316

317317
fn function_call(
318318
&mut self,
319-
func: RValue<'gcc>,
319+
func: Function<'gcc>,
320320
args: &[RValue<'gcc>],
321321
_funclet: Option<&Funclet>,
322322
) -> RValue<'gcc> {
323-
// TODO(antoyo): remove when the API supports a different type for functions.
324-
let func: Function<'gcc> = self.cx.rvalue_as_function(func);
325323
let args = self.check_call("call", func, args);
326324

327325
// gccjit requires to use the result of functions, even when it's not used.
@@ -1753,6 +1751,8 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
17531751
// FIXME(antoyo): remove when having a proper API.
17541752
let gcc_func = unsafe { std::mem::transmute::<RValue<'gcc>, Function<'gcc>>(func) };
17551753
let call = if self.functions.borrow().values().any(|value| *value == gcc_func) {
1754+
// TODO(antoyo): remove when the API supports a different type for functions.
1755+
let func: Function<'gcc> = self.cx.rvalue_as_function(func);
17561756
self.function_call(func, args, funclet)
17571757
} else {
17581758
// If it's a not function that was defined, it's a function pointer.

0 commit comments

Comments
 (0)