Despite the vocal support from tech billionaire Peter Thiel, Republican presidential candidate Donald Trump definitely isn't a favorite in Silicon Valley.

Apple (AAPL) CEO Tim Cook hosted a fundraiser for Hillary Clinton earlier this year, and the web site CrowdPac suggests that the Republican nominee receives little of the cash that the tech sector donates to the presidential race. Facebook (FB) co-founders Chris Hughes and Dustin Moskovitz, along with eBay (EBAY) founder Pierre Omidyar created the anti-Trump political action committee "Not Who We Are."

Though the Valley shows the candidate little love, the big tech companies would likely get some benefit from Trump's policies on taxes and offshore cash. A Trump administration would not be a four-year stroll in the Rose Garden, though. Trump's take on trade policy and immigration of highly-skilled workers would likely hamper the tech sector's plans.

Overseas cash has become a rich man's problem for Silicon Valley. Tech companies built up vast stockpiles of money overseas, but face a tax hit if they bring it home to pay dividends or other purposes.

Apple will have $230 billion in offshore cash at the end of the year, Moody's projects, while Microsoft (MSFT) will have $113 billion. Cisco (CSCO) will have $62 billion outside the U.S., Moody's estimates, while Oracle (ORCL) will have $52 billion and Alphabet (GOOGL) will have $49 billion.

Apple, Facebook, Cisco and Alphabet are holdings in Jim Cramer's Action Alerts PLUS Charitable Trust Portfolio. Want to be alerted before Cramer buys or sells AAPL, FB, CSCO and GOOGL? Action Alerts PLUS Charitable Trust Portfolio

Some firms, like Microsoft and Qualcomm (QCOM) , have drawn on international cash to fund acquisitions.

But bringing the cash back to the U.S. could carry a tax hit of up to 39%, when including local taxes. Trump's tax plan would offer companies a one-time tax rate of 10% for repatriated cash.

For a company like Apple, that would mean the difference between a nearly $90 billion tax bill and a $23 billion payout if it were to bring all of its cash back to the U.S. That $67 billion discount is greater than the market cap of Salesforce.com (CRM) , which stands at about $51 billion.

While the payout would give free up billions of dollars in cash for the largest tech concerns, some of Trump's other moves would play out less well for them.

For example, Trump called for a boycott of Apple products in February, when the company refused law enforcement requests to unlock an iPhone belonging a shooter involved in attacks in San Bernadino, Calif.

And, as TheStreet.com has reported, a number of economists believe Trump's policies would damage the larger economy. By the end of Trump's first year in office, Gregory Daco of Oxford Economics projects, the U.S. would enter recession. Back in June, Moody's Analytics predicted a "lengthy recession" if Trump takes office, with GDP falling 2.4% drop, unemployment rising to 7.4% and U.S. job rolls declining by 3.4 million.

Trump has also accused Amazon CEO Jeff Bezos of using the Washington Post as a "tool for political power," and raised the prospect of investigating Amazon.com on tax and antitrust issues. Bezos bought the newspaper for $250 million in 2013.

"Amazon is getting away with murder tax-wise," Trump told Sean Hannity in an interview in May. "He's using the Washington Post, which is peanuts, he's using that for political purposes to save Amazon in terms of taxes and in terms of antitrust."

Trump has promised to "rip up" trade agreements and to take a particularly tough stance with China. He also opposes the Trans-Pacific Partnership agreement with nations in the Pacific Rim, which President Obama favors.

The pact has support from the Silicon Valley Leadership Group, a public policy organization that counts Apple, AT&T (T) , Google, Facebook, Microsoft, and The Internet Association as members. The Internet Association is a lobbying group whose members include Amazon.com (AMZN) , eBay, Google, Yahoo (YHOO) , SnapChat, Facebook and LinkedIn (LNKD) .

Tough talk on trade could also complicate business for tech companies that make phones and other devices.

"Over the last couple of decades, the vast amount of the overall supply chain that goes into the making of the electronic components, gadgets and devices the industry has basically centered around Asia," said Moody's analyst Gerald Granovsky, who declined to comment on the election itself or the candidates.

A single product could contain hundreds of components that are internationally sourced.

"OK, [Apple contractor] Foxconn moves the assembly to the U.S. It still needs to get the memory chips and storage chips from plants in Thailand and China," Granovsky said. "Jabil's (JBO) casings for the iPhone are in China. Does that mean there is going to be a tariff on those casings that Apple will need to import into the U.S. for the final assembly here?"

Imposing tariffs could spur tech companies to move production to the U.S. However, the global supply chain would be difficult and costly to replicate, and tech companies could decide not to bring production back to the U.S.

There is a reason, after all, that the big tech groups have vast overseas cash hoards. For many of the major, multinational tech companies, the bulk of sales come from international markets and not from the U.S.

Companies could therefore keep their international production facilities to serve the rest of the world, where they would not have to pay tariffs, Granovsky suggested. "If there is a large tariff on the imported products, we'll make the end user pay the increased cost," he added.

Therefore, an unintended consequence could be higher prices for devices for consumers in the U.S. 

A Trump administration could also limit the supply of highly skilled tech workers. Trump has proposed increasing the wages paid to workers using H-1B visas, the form of visa for immigrants with sought-after skills that his wife Melania Trump obtained in the 1990s to come to the U.S. as a model. Trump argues that increasing the cost of foreign workers would provide an incentive to hire U.S. workers. 

By contrast, Silicon Valley argues that it needs larger quotas of H-1B visas. The issue hits home for tech leaders such as Dropbox's chief technology officer Aditya Agarwal, who's used multiple H-1B visas to work in the U.S. Mark Zuckerberg and Bill Gates are among the founders of FWD.us, an advocacy group that lobbies for immigration reform and looser visa policies for entrepreneurs.

"Overwhelmingly the tech sector supports increased quotas for the H-1Bs," Granovsky said. "What we are hearing from them is it's not so much a cost savings measure here, it's the availability of the talent pool."

For tech investors, a Trump Presidency therefore presents a difficult equation. The math behind repatriating overseas cash is straightforward. But the cost of tearing up trade agreements and limiting visas for tech workers is harder to calculate.

If you liked this article you might like

Home Depot Exec Reveals One Secret Behind the Company's Massive Success

Home Depot Exec Reveals One Secret Behind the Company's Massive Success

Profit With Technical Analysis: Cramer's 'Mad Money' Recap (Tuesday 2/20/18)

Profit With Technical Analysis: Cramer's 'Mad Money' Recap (Tuesday 2/20/18)

Jim Cramer: The Government Should Admit It Goofed With These Crazy Instruments

Jim Cramer: The Government Should Admit It Goofed With These Crazy Instruments

There Are Many Signs Investors Have Totally Forgotten About S&P 500 Correction

There Are Many Signs Investors Have Totally Forgotten About S&P 500 Correction

Quick Tips: Now What Should Investors Do?

Quick Tips: Now What Should Investors Do?