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
282282 // thunk size greater than 32 bytes. For RISCV and x86_64, the
283283 // thunk setup doesn't go through __trampoline_setup and fits in 32
284284 // 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 ();
292286 mlir::Type buffTy = SequenceType::get ({thunkSize}, i8Ty);
293287 auto buffer = builder.create <AllocaOp>(loc, buffTy);
294288 mlir::Value closure =
Original file line number Diff line number Diff line change @@ -498,6 +498,9 @@ class Triple {
498498 return getArchPointerBitWidth (getArch ());
499499 }
500500
501+ // / Returns the trampoline size in bytes for this configuration.
502+ unsigned getTrampolineSize () const ;
503+
501504 // / Test whether the architecture is 64-bit
502505 // /
503506 // / 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) {
17111711 llvm_unreachable (" Invalid architecture value" );
17121712}
17131713
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+
17141734bool Triple::isArch64Bit () const {
17151735 return getArchPointerBitWidth (getArch ()) == 64 ;
17161736}
You can’t perform that action at this time.
0 commit comments