Gym while pregnant

Is it bad to go to the gym while pregnant ?! I wanna go just to walk on the tread mill and do leg workouts only nothing massive .