llvm.org GIT mirror llvm / 58839f4
Change @llvm.clear_cache default to call rt-lib After some discussion on IRC, emitting a call to the library function seems like a better default, since it will move from a compiler internal error to a linker error, that the user can work around until LLVM is fixed. I'm also adding a note on the responsibility of the user to confirm that the cache was cleared on platforms where nothing is done. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204806 91177308-0d34-0410-b5e6-96231b3b80d8 Renato Golin 6 years ago
4 changed file(s) with 16 addition(s) and 15 deletion(s). Raw diff Collapse all Expand all
69636963 When directly supported, this intrinsic will either return a call to
69646964 the appropriate cache clearing system call (usually ``__clear_cache``)
69656965 when the caches are not unified (ARM, Mips) or just remove the call
6966 altogether when they are (ex. x86_64).
6968 Targets must implement it directly to have either behaviour, as the
6969 default is to bail with "Not Implemented" message.
6966 altogether when they are (ex. x86_64). Some targets can lower these
6967 directly into special instructions, if they have it.
6969 The default behaviour is to emit a call to ``__clear_cache``, so in
6970 case a target doesn't support it, the user gets a linker error rather
6971 than a compiler internal error. It also provides a work around to
6972 the user (implement an empty function called ``__clear_cache``) while
6973 LLVM doesn't implement it in the target's back-end.
6975 Please note that the caller is responsible for ensuring the cache
6976 is actually cleared. This is most important in targets that don't
6977 need to flush the cache directly (ex. x86_64) and could potentially
6978 still execute old instructions while the cache is not cleared. LLVM
6979 will *not* insert nops or busy-wait sequences.
69716981 Standard C Library Intrinsics
69726982 -----------------------------
21082108 }
21102110 /// Return the builtin name for the __builtin___clear_cache intrinsic
2111 /// Default is to invoke the clear cache library call
21112112 virtual const char * getClearCacheBuiltinName() const {
2112 llvm_unreachable("Not Implemented");
2113 return "__clear_cache";
21132114 }
21152116 /// Return the type that should be used to zero or sign extend a
382382 /// to just the constant itself.
383383 bool shouldConvertConstantLoadToIntImm(const APInt &Imm,
384384 Type *Ty) const override;
386 /// Clear cache library call
387 const char * getClearCacheBuiltinName() const {
388 return "__clear_cache";
389 }
391386 protected:
392387 std::pair
584584 bool MemcpyStrSrc,
585585 MachineFunction &MF) const;
587 /// Clear cache library call
588 const char * getClearCacheBuiltinName() const {
589 return "__clear_cache";
590 }
592587 /// isFPImmLegal - Returns true if the target can instruction select the
593588 /// specified FP immediate natively. If false, the legalizer will
594589 /// materialize the FP immediate as a load from a constant pool.