Subwavelength engineering of silicon waveguides and cavities for nonlinear photonics