For nearly a decade now, ever since the dark days of the Great Recession, I've taken a value-investing approach to investing in the stock market.

Back then, in the deep, dark hole that was 2009, some of the world's best companies were selling for a song, and value investing was easy. In today's overheated market, with the S&P 500 up more than threefold off its February 2009 lows, value investing isn't so easy anymore.

But it can still make you rich.

Illuminated circuits branch out from a computer chip.

Investing in semiconductor stocks can make you rich -- if you buy them cheaply enough. Image source: Getty Images.

Three simple rules

The secret to getting rich from the stock market, I've found, consists of knowing three simple rules, and sticking to those rules no matter how expensive the stock market gets.

Rule No. 1 is to invest only in companies generating strong free cash flow. No matter how much profit a company's income statement says it's making, if it's not generating cash, it's too risky to invest in.

Rule No. 2: It has to be cheap. I don't like to pay more than 10 times the amount of free cash flow that a company generates in a year (i.e., an enterprise value-to-free cash flow ratio of 10). However...

Rule No. 3: Growth is good. If a company is growing its profits fast enough to justify a higher price, I'll pay it. As a rule of thumb, I seek 10% growth to justify a company selling for 10 times free cash flow, 20% growth for a 20 EV/FCF ratio, 30% for 30 -- and so on. This is not a hard and fast rule, but more of a guidepost to ensure I'm not overpaying for growth.

It all boils down to this: I invest in stocks selling for an enterprise value-to-free cash flow-to-growth (EV/FCF/G) ratio of less than 1.0. Admittedly, this is only a variation on the old PEG ratio method of investing popularized by legendary former Fidelity Magellan manager Peter Lynch, but it's the variant I feel most comfortable using. On one hand, it greatly limits the numbers of stocks meeting my criteria for investment. On the other hand, it allows me to focus my efforts on examining just a handful of promising stocks.

Here are three I've come up with.

Cirrus Logic

Cirrus Logic (CRUS 2.99%) is a semiconductor chipmaker, and not just any old chipmaker, but one that focuses on audio chips used in smartphones, tablets, virtual-reality headsets, and so on. Cirrus is just coming off an impressive fourth quarter  that saw it report 41% year-over-year sales growth -- and 150% growth in earnings. Despite this fantastic growth, Cirrus is one very cheap stock.

With a market capitalization of $4.2 billion and more than $390 million in net cash, Cirrus boasts an enterprise value of only $3.8 billion. Free cash flow at the company is very strong -- $328 million last year, versus only $261 million in reported GAAP earnings. Thus, while Cirrus Logic stock has only a modestly appealing P/E ratio of 16.6, the stock is downright cheap when valued on free cash flow. Its enterprise value-to-free cash flow ratio (EV/FCF) rings in at 11.6 -- which seems quite a bargain, given that analysts quoted on S&P Global Market Intelligence see the stock growing at 15% annually over the next five years.

Ambarella

The story with Ambarella (AMBA 0.15%) isn't quite the same, but it does rhyme. A chipmaker like Cirrus, Ambarella focuses on semiconductors used in video imaging rather than on audio. Ambarella suffered a sales shortfall in the first half of 2017 -- but then came roaring back. Over the past three quarters, Ambarella's sales growth has averaged 16% year over year.

Last week, Ambarella spooked investors  with warnings of potential customer losses and conservative guidance, which sparked a sell-off in the stock and has folks worrying of a repeat of last year's troubles. That may very well be how things play out. But given how cheap the stock has become, Ambarella may be worth the risk.

With a $1.7 billion market cap and $420 million in cash at Ambarella, I put its enterprise value at a mere $1.3 billion. That doesn't look cheap relative to trailing GAAP earnings of $59 million. But Ambarella is generating cash profits at twice the rate it reports GAAP net income -- $117 million over the past year. That works out to an EV/FCF ratio of only 11.1, which will prove to be a cheap price if Ambarella even comes close to meeting analyst expectations of 15% long-term growth.

Valero

For my final value pick today, I'm going to switch gears, and sectors, from tech to oil. Valero (VLO 1.23%) is one of the biggest names in oil refining in the U.S. -- and just a big company, period. Valero boasts a market cap several times larger than the stocks so far discussed: $29.8 billion. Unlike the techs, it also carries a heaping helping of debt: $4 billion worth. That works out to an enterprise value of $33.8 billion.

Yet while the techs count their profits in the millions, Valero's earnings and free cash flow break well into the billions. GAAP profit for the past 12 months approximated $2.1 billion, and cash profits were even more robust -- $3.8 billion -- yielding an EV/FCF ratio of just 8.9 on this stock.

Relative to Valero's projected 13% long-term profits growth rate, that's a bargain price, and that's before you even notice that unlike the techs, Valero pays its shareholders a big dividend, yielding 4.2% annually.

Unless electric cars push the internal-combustion engine into obsolescence -- I don't own an electric car; do you? -- I see little risk that Valero's business will go away anytime soon. At today's prices, I think the stock's a safe bet to outperform the market -- and make some investors rich.