If the issue is illegal vs legal, give the illegal immigrants work visas, making them legal. Problem solved, right?
You seem to think there's some bright line here, when there really isn't. The vast majority of illegal immigrants would love to come legally, and are here to work and to contribute, but we won't let them. It's insanely difficult to immigrate legally except as a wealthy student or with corporate sponsorship. Outside of those categories it is -- quite literally -- a game of chance, a system of tiny quotas allocated by big lotteries.
It's criminal how you and others cannot seem to distinguish between legal and illegal immigration, which are vastly different things.
That distinction is based on the lines drawn by our immigration laws, which are very arbitrary and capricious, in both design and implementation. I find it really interesting how none of the people who rail against illegal immigration actually know (or care!) how legal immigration works and whether or not the rules are in any way effective at dividing those we'd like to have from those we wouldn't.
Put the cart in front of the horse: reform immigration laws so immigration is possible for those who just want to come and work, then enable all of the current illegal immigrants to make use of the revised laws to obtain legal status and then we can figure out how to secure the borders. At that point it will be much easier because there will be many fewer people anxious to sneak in.