File tree Expand file tree Collapse file tree 3 files changed +24
-7
lines changed
flang/lib/Optimizer/CodeGen
include/llvm/TargetParser Expand file tree Collapse file tree 3 files changed +24
-7
lines changed Original file line number Diff line number Diff line change @@ -282,13 +282,7 @@ class BoxedProcedurePass
282
282
// thunk size greater than 32 bytes. For RISCV and x86_64, the
283
283
// thunk setup doesn't go through __trampoline_setup and fits in 32
284
284
// bytes.
285
- fir::SequenceType::Extent thunkSize = 32 ;
286
- if (triple.isPPC32 ())
287
- thunkSize = 40 ;
288
- else if (triple.isPPC64 ())
289
- thunkSize = 48 ;
290
- else if (triple.isAArch64 ())
291
- thunkSize = 36 ;
285
+ fir::SequenceType::Extent thunkSize = triple.getTrampolineSize ();
292
286
mlir::Type buffTy = SequenceType::get ({thunkSize}, i8Ty);
293
287
auto buffer = builder.create <AllocaOp>(loc, buffTy);
294
288
mlir::Value closure =
Original file line number Diff line number Diff line change @@ -498,6 +498,9 @@ class Triple {
498
498
return getArchPointerBitWidth (getArch ());
499
499
}
500
500
501
+ // / Returns the trampoline size in bytes for this configuration.
502
+ unsigned getTrampolineSize () const ;
503
+
501
504
// / Test whether the architecture is 64-bit
502
505
// /
503
506
// / Note that this tests for 64-bit pointer width, and nothing else. Note
Original file line number Diff line number Diff line change @@ -1711,6 +1711,26 @@ unsigned Triple::getArchPointerBitWidth(llvm::Triple::ArchType Arch) {
1711
1711
llvm_unreachable (" Invalid architecture value" );
1712
1712
}
1713
1713
1714
+ unsigned Triple::getTrampolineSize () const {
1715
+ switch (getArch ()) {
1716
+ default :
1717
+ break ;
1718
+ case Triple::ppc:
1719
+ case Triple::ppcle:
1720
+ if (isOSLinux ())
1721
+ return 40 ;
1722
+ break ;
1723
+ case Triple::ppc64:
1724
+ case Triple::ppc64le:
1725
+ if (isOSLinux ())
1726
+ return 48 ;
1727
+ break ;
1728
+ case Triple::aarch64:
1729
+ return 36 ;
1730
+ }
1731
+ return 32 ;
1732
+ }
1733
+
1714
1734
bool Triple::isArch64Bit () const {
1715
1735
return getArchPointerBitWidth (getArch ()) == 64 ;
1716
1736
}
You can’t perform that action at this time.
0 commit comments