[lld] r219655 - [mach-o] Add Pass to create are shim Atoms for ARM interworking.

Nick Kledzik kledzik at apple.com
Mon Oct 20 10:38:57 PDT 2014


On Oct 20, 2014, at 10:06 AM, Shankar Easwaran <shankare at codeaurora.org> wrote:

> 
> On 10/20/2014 11:46 AM, Nick Kledzik wrote:
>> On Oct 18, 2014, at 8:13 PM, Shankar Easwaran <shankare at codeaurora.org> wrote:
>> 
>>> Hi Nick,
>>> 
>>> This patch doesnot seem to reuse shim's right ?
>> It does re-use them.  The pass has used _targetToShim to maintain a map of shim atoms produced for each target atom.  If two locations branch to the same target and both need a shim, the same shim is re-used.
> Ah ok. I couldnt find on where does it check if the shim that it created before is still in range for it to be reused ? Do you do this in a separate pass ?


102  const DefinedAtom* getShim(bool thumbToArm, const DefinedAtom& target) {
103	    auto pos = _targetToShim.find(&target);
104	    if ( pos != _targetToShim.end() ) {
105	      // Reuse an existing shim.
106	      assert(pos->second != nullptr);
107	      return pos->second;
108	    } else {
109	      // There is no existing shim, so create a new one.
110	      const DefinedAtom *shim = _archHandler.createShim(_file, thumbToArm,
111	                                                        target);
112	       _targetToShim[&target] = shim;
113	       return shim;
114	    }
115	  }
116





More information about the llvm-commits mailing list